1、查看当前版本
cmake --version
删除原来cmake版本,建立软连接,测试
yum remove cmake -y
2、下载获得cmake-3.9.2源码
wget //cmake.org/files/v3.9/cmake-3.9.2.tar.gz
3、解压、安装新版本
tar -xvf cmake-3.9.2.tar.gz
cd cmake-3.9.2
./configure
sudo make && make install
【注】安装完后,执行cmake --version会报如下错误
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/Applications/CMake 2.8-11.app/Contents/bin
CMake Error: Error executing cmake::LoadCache(). Aborting.
【解决方法】
先执行:hash -r
然后再执行:cmake --version
完美解决