Ubuntu 20.04安装CMake 3.22.6版本

Ubuntu 20.04通过apt安装的cmake版本是3.16.3,默认安装到/usr/bin/cmake路径。

$ cmake 

Command 'cmake' not found, but can be installed with:

sudo snap install cmake  # version 3.29.3, or
sudo apt  install cmake  # version 3.16.3-1ubuntu1.20.04.1

See 'snap info cmake' for additional versions.

如果想安装其他版本,比如v3.22.6,可以到cmake的历史版本网页中下载。

Index of /files/v3.22icon-default.png?t=N7T8https://cmake.org/files/v3.22/下载路径:

https://cmake.org/files/v3.22/cmake-3.22.6-linux-x86_64.shicon-default.png?t=N7T8https://cmake.org/files/v3.22/cmake-3.22.6-linux-x86_64.sh

下面是在Ubuntu上的安装过程

# 创建目录
$ sudo mkdir /opt/cmake

# 下载文件
$ cd /opt/cmake
$ sudo wget https://cmake.org/files/v3.22/cmake-3.22.6-linux-x86_64.sh
$ sudo chmod +x cmake-3.22.6-linux-x86_64.sh

# 安装程序,期间要回复确认
$ sudo ./cmake-3.22.6-linux-x86_64.sh

# 创建软连接
$ cd /usr/bin
$ sudo ln -s /opt/cmake/cmake-3.22.6-linux-x86_64/bin/cmake cmake

安装完成后,即可在任意路径执行cmake 

~$ cmake 
Usage

  cmake [options] <path-to-source>
  cmake [options] <path-to-existing-build>
  cmake [options] -S <path-to-source> -B <path-to-build>

Specify a source directory to (re-)generate a build system for it in the
current working directory.  Specify an existing build directory to
re-generate its build system.

Run 'cmake --help' for more information.

  • 10
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值