ubuntu下面实现将Cmake由3.5.2版本升级到3.9.2

由于近期项目需求,需要对cmake进行升级,故记录下cmake由3.5.2版本升级到3.9.2的过程。

第一步:查看自己系统cmake的当前版本

1.1 执行 sudo -s切换到root权限用户下

1.2 执行cmake --version

第二步:下载3.9.2版本的cmake源代码

2.1 执行 wget https://cmake.org/files/v3.9/cmake-3.9.2.tar.gz

2.2 执行解压缩源码 tar -xvf cmake-3.9.2.tar.gz

2.3 进入到cmake源码目录,执行cd cmake-3.9.2

第三步:编译3.9.2版本的cmake

3.1 在cmake-3.9.2路径下执行./configure

3.2 执行sudo make && sudo make install(注意这里一般两个sudo缺一不可)

3.3 查看现在的版本,执行cmake --version,一般没有错误的话会显示已经是3.9.2版本。

如果这一步出现如下错误:

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, 成功更新!!!

发布了96 篇原创文章 · 获赞 96 · 访问量 22万+

猜你喜欢

转载自blog.csdn.net/qq_33221533/article/details/100110282