cmake多版本共存
方式1
1.从 CMake 官网 下载所需版本的 .sh 或 .tar.gz 包
2.安装到不同目录
安装 CMake 3.20
sudo sh cmake-3.20.0-linux-x86_64.sh --prefix=/opt/cmake-3.20.0 --skip-license
安装 CMake 3.25
sudo sh cmake-3.25.0-linux-x86_64.sh --prefix=/opt/cmake-3.25.0 --skip-license
3.使用 update-alternatives 管理版本
sudo update-alternatives --install /usr/bin/cmake cmake /opt/cmake-3.20.0/bin/cmake 100
sudo update-alternatives --install /usr/bin/cmake cmake /opt/cmake-3.25.0/bin/cmake 200
4.切换版本
sudo update-alternatives --config cmake
方式2
1.修改环境变量
sudo gedit ~/.bashrc
在文件中添加
export PATH=/home/anghigh/software/cmake-3.31.6-linux-x86_64/bin:$PATH
保存
1809

被折叠的 条评论
为什么被折叠?



