下载
https://github.com/Kitware/CMake/releases
[root@ALiYunOgenes ~]# wget https://github.com/Kitware/CMake/releases/download/v3.22.0/cmake-3.22.0.tar.gz
解压
[root@ALiYunOgenes ~]# tar zxf cmake-3.22.0.tar.gz
安装
[root@ALiYunOgenes ~]# cd cmake-3.22.0/
[root@ALiYunOgenes cmake-3.22.0]# ./bootstrap --prefix=/usr --datadir=share/cmake --docdir=doc/cmake && make
[root@ALiYunOgenes cmake-3.22.0]# make install
[root@ALiYunOgenes cmake-3.22.0]# cmake --version
note
内存不足时会报错 “ g++: internal compiler error: Killed (program cc1plus) ”,增加swap交换分区可解决。
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
gmake: *** [cmGeneratorTarget.o] Error 4
---------------------------------------------
Error when bootstrapping CMake:
Problem while running gmake
---------------------------------------------
Log of errors: /root/cmake-3.22.0/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------