centos7. 编译安装cmake 3.23.0

 

参考地址: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 -j4  

// 安装
sudo
make install

指定 cmake 软链接这样可以在全局使用它,你可以把/usr/local/cmake/bin/cmake 指定到/usr/bin/cmake 或者 /usr/local/bin/cmake, 我们推荐使用/usr/local/bin/cmake,具体的请去百度了解一下/usr/bin 和 usr/local/bin的区别

sudo  ln -s /usr/local/cmake/bin/cmake /usr/local/bin/cmake
sudo  ln -s /usr/local/cmake/bin/cpack /usr/local/bin/cpack

sudo ln
-s /usr/local/cmake/bin/ctest /usr/local/bin/ctest

 

posted @ 2023-12-09 15:56  He_LiangLiang  阅读(660)  评论(0编辑  收藏  举报