UBUNTU环境下Cmake版本 更改 升级
通过apt安装的版本较低
sudo apt-get install cmake
官方给出的: https://cmake.org/download/
The release was packaged with CPack which is included as part of the release. The .sh files are self extracting gziped tar files. To install a .sh file, run it with /bin/sh and follow the directions. The OS-machine.tar.gz files are gziped tar files of the install tree. The OS-machine.tar.Z files are compressed tar files of the install tree. The tar file distributions can be untared in any directory. They are prefixed by the version of CMake. For example, the Linux-x86_64 tar file is all under the directory cmake–Linux-x86_64. This prefix can be removed as long as the share, bin, man and doc directories are moved relative to each other. To build the source distributions, unpack them with zip or tar and follow the instructions in Readme.txt at the top of the source tree.
翻译过来:
该发行版与CPack打包在一起,而CPack包含在发行版中。.sh文件是自解压缩gzip压缩的tar文件。要安装.sh文件,请使用/ bin / sh运行该文件并按照说明进行操作。OS-machine.tar.gz文件是安装树的gzip压缩tar文件。OS-machine.tar.Z文件是安装树的压缩tar文件。tar文件发行版可以在任何目录中解压。它们以CMake版本作为前缀。例如,Linux-x86_64 tar文件都在cmake–Linux-x86_64目录下。**只要share,bin,man和doc目录相对于彼此移动,就可以删除此前缀。**要构建源发行版,请使用zip或tar解压缩它们,并按照源树顶部的Readme.txt中的说明进行操作。
因此只需要将其软链接到/usr/bin/中覆盖系统原始的cmake即可实现版本替换。
wget -P /opt/ https://cmake.org/files/v3.14/cmake-3.14.0-Linux-x86_64.tar.gz
tar zxvf /opt/cmake-3.14.0-Linux-x86_64.tar.gz -C /opt
cd /opt/cmake-3.14.0-Linux-x86_64
ln -sf /opt/cmake-3.14.0-Linux-x86_64/bin/* /usr/bin/
cmake --version
echo "done"
详细请参照参考资料
参考资料:
https://blog.csdn.net/whutshiliu/article/details/106480024
http://www.cmake.org/files