ubuntu16.04系统自带cmake,ctrl+alt+t打开终端,输入cmake --version可以查看当前cmake版本
Ubuntu16.04中自带的cmake版本为3.5.1
1.下载
wget https://cmake.org/files/v3.14/cmake-3.14.5.tar.gz
2.解压
tar -xzvf cmake-3.14.5.tar.gz
cd cmake-3.14.5/
3.编译
这一步可能需要很长时间,依次输入
./bootstrap
make
sudo make install
1)./bootstrap
2)make
3)sudo make install
可以指定安装路径
make install DESTDIR= `pwd`/install
4.查看当前cmake版本
cmake --version
5.此时可能输入cmake --version,出现以下问题
CMake Error:Could not find CMAKE_ROOT !
CMake has most likely not been installed correctly
Modules directory not found in
/usr/local/share/cmake-3.5
cmake version 3.5.1 //我的默认cmake版本是3.5.1
CMake suite maintained and supported by kitware (kitware.com/cmake)
此时终端输入:
sudo ln -s /M100/cmake-3.14.5/bin/* /usr/bin
即可。
sudo ln -s cmake路径/bin/* /usr/bin
输入cmake --version
输出:cmake version 3.14.5