环境:ubuntu 16.04
查看当前cmake版本:cmake --version
卸载当前cmake:sudo apt remove cmake(有些场合不能用次方法卸载,自行判断)
下载新包:下载地址:https://github.com/Kitware/CMake/releases
选择自己需要的版本下载
下载cmake-xxx.tar.gz源码包
解压安装:
tar -zxvf CMake-3.16.8.tar.gz
cd CMake-3.16.8
./configure
若报错:Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_RO,执行:sudo apt-get install libssl-dev,再 ./configure
make
sudo make install
sudo cp bin/cmake /usr/bin
查看版本:
cmake --version