参考地址:https://www.zhudo.net/server/linux/125.html
1、先检查并卸载老版本
yum remove cmake
2、准备安装好cmake所需的依赖
yum -y install gcc gcc-c++ openssl openssl-devel tar
3、下载源码
官方地址:
https://github.com/Kitware/CMake/releases/download/v3.23.0/cmake-3.23.0.tar.gz
可以在浏览器里面直接下载,也可以linux 命令端通过 wget 下载
wget https://github.com/Kitware/CMake/releases/download/v3.23.0/cmake-3.23.0.tar.gz
git地址:
https://github.com/Kitware/CMake/releases/download/v3.23.0/cmake-3.23.0.tar.gz
wget https://github.com/Kitware/CMake/releases/download/v3.23.0/cmake-3.23.0.tar.gz
4.解压并进入安装包
tar -zvxf cmake-3.23.0.tar.gz cd cmake-3.23.0
5.编译 安装
//指定安装目录为usr/local/cmake ./bootstrap --prefix=/usr/local/cmake --datadir=share/cmake --docdir=doc/cmake //编译并安装 make && make install
指定 cmake 软链接这样可以在全局使用它,你可以把/usr/local/cmake/bin/cmake 指定到/usr/bin/cmake 或者 /usr/local/bin/cmake, 我们推荐使用/usr/local/bin/cmake,具体的请去百度了解一下/usr/bin 和 usr/local/bin的区别
ln -s /usr/local/cmake/bin/cmake /usr/local/bin/cmake ln -s /usr/local/cmake/bin/cpack /usr/local/bin/cpack ln -s /usr/local/cmake/bin/ctest /usr/local/bin/ctest
标签:bin,cmake,tar,centos7.9,3.23,usr,local From: https://www.cnblogs.com/music-liang/p/17891080.html