date:
updated:
CentOS7 升级 cmake
参考 centos7升级 cmake
使用安装命令无法升级 cmake
1 2
| yum remove -y cmake sudo yum -y install cmake
|
仍是 2.8.12.2
1 2
| [root@localhost build] cmake version 2.8.12.2
|
只能编译安装
删除旧版本 cmake
安装需要的模块
1
| yum install -y libxml2 libxml2-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel zstd libzstd-devel curl libcurl-devel libpng libpng-devel
|
下载 cmake 源代码
官网地址为 https://cmake.org,选择 download 中的源代码文件
1 2
| wget https://github.com/Kitware/CMake/releases/download/v3.23.0/cmake-3.23.0.tar.gz tar -zxvf cmake-3.23.0.tar.gz
|
编译 cmake
1 2 3 4 5 6 7
| cd cmake-3.23.0 mkdir build cd build ../configure --prefix=/usr/local/cmake-3.23.0 gmake -j2
gmake install
|
配置环境
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| touch /etc/profile.d/cmake.sh chmod 777 /etc/profile.d/cmake.sh echo -e '\nexport PATH=/usr/local/cmake-3.23.0/bin:$PATH\n' >> /etc/profile.d/cmake.sh source /etc/profile.d/cmake.sh
|
重启服务器
查看cmake版本
1 2 3 4
| [root@localhost build] cmake version 3.23.0
CMake suite maintained and supported by Kitware (kitware.com/cmake).
|
cmake 升级成功