问题描述:之前已安装cmake 3.1.0, 但是后来接着安装了ccmake,是简单用的命令“sudo apt-get install cmake-curses-gui”,这个版本的cmake-curses-gui包中是用的cmake 2.8.7,详情点此。这就导致目前我系统中默认的cmake版本不是我安装的新版本。下文首先删除了系统默认的cmake版本,并将之前下载安装的最新版本cmake 3.1.0设置为系统默认的cmake。
查看当前系统中cmake版本:
test@test:~$ cmake --version
cmake version 2.8.7
删除旧版cmake:
test@test:~$ sudo apt-get remove cmake
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
x11-apps ibus-gtk3 libwayland-ltst-client0 cmake-data libtxc-dxtn-s2tc0 x11-session-utils x11-xfs-utils libxrandr-ltst2 ibus-pinyin-db-android libwayland-ltst-server0 xinit libxmlrpc-core-c3 libllvm3.4
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
cmake cmake-curses-gui
0 upgraded, 0 newly installed, 2 to remove and 128 not upgraded.
After this operation, 13.9 MB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 152449 files and directories currently installed.)
Removing cmake-curses-gui ...
Removing cmake ...
Processing triggers for man-db ...
test@test:~$ cmake -version
bash: /usr/bin/cmake: No such file or directory
确保已将之前安装的cmake 3.1.0路径添加到系统PATH,可以通过如下命令查看:
test@test:~$ echo $PATH
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/cmake-3.1.0/bin
完毕。此时系统默认的cmake已经是3.1.0版本了,查看:
test@test:~$ cmake --version
cmake version 3.1.0
CMake suite maintained and supported by Kitware (kitware.com/cmake).
参考:
http://stackoverflow.com/questions/14519841/ubuntu-upgrading-software-cmake-version-disambiguation-local-compile