1.通过PPA安装:
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:george-edison55/cmake-3.x
$ sudo apt-get update
还未安装cmake:
$ sudo apt-get install cmake
安装过cmake:
$ sudo apt-get upgrade
2.通过下载安装包自己安装,从这里获取安装包: Downloads,这里安装3.2.2版本。
cmake source install as follows:
0 cd ~
1 wget https://cmake.org/files/v3.5/cmake-3.5.2.tar.gz
2 tar xvf cmake-3.5.2.tar.gz
This worked for me then:
3 cd cmake-3.5.2
4 ./bootstrap --prefix=/usr
这一步很关键,如果没有指定prefix,后面使用时会报错Could not find CMAKE_ROOT
5 make
6 sudo make install
check:
cmake --version
[root@localhost cmake-3.5.2]# cmake --version cmake version 3.5.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).