1、先新建一个文件夹来存放cmake
mkdir app
cd app
2、安装 gcc 等必备程序包
yum install -y gcc gcc-c++ make automake
3、安装 wget
yum install -y wget
4、获取 CMake 源码包
wget https://cmake.org/files/v3.22.0/cmake-3.22.0.tar.gz
或者
wget -c https://github.com/Kitware/CMake/releases/download/v3.22.0-rc3/cmake-3.22.0-rc3.tar.gz
5、解压
tar -zxvf cmake-3.22.0.tar.gz
6、进入 cmark 的源码目录
cd cmake-3.22.0
7、运行当前目录下的一个文件
./bootstrap
注意:
-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR)
CMake Error at Utilities/cmcurl/CMakeLists.txt:485 (message):
Could not find OpenSSL. Install an OpenSSL development package or
configure CMake with -DCMAKE_USE_OPENSSL=OFF to build without OpenSSL.
解决方式 安装
yum install -y openssl openssl-devel 即可解决问题
8、运行命令
gmake
9、进行安装
make install
10、软链:
ln -s /usr/local/bin/cmake /usr/bin/
10、查看版本
cmake --version