背景
使用cmake编译的时候提示:CMake 3.20 or higher is required. You are running version 3.16.3.
Ubuntu20.04 apt install cmake默认安装的是3.16.3版本,当需要编译一些比较新的库时会提示cmake版本过低。
解决方法
1、下载cmake新版本
进入cmake下载的官网:https://cmake.org/files/ ,选择>=3.20的版本,下载对应的.sh或tar包。
我这里下载的3.30.0版本:
# 一键安装脚本
wget https://cmake.org/files/v3.30/cmake-3.30.0-linux-x86_64.sh
or
# 源码
wget https://cmake.org/files/v3.30/cmake-3.30.0.tar.gz
2、安装cmake新版本
# 一键安装脚本
sudo bash cmake-3.30.0-linux-x86_64.sh --skip-license --prefix=/usr
or
# 源码直接编译
$ tar xzf cmake-3.30.0.tar.gz
$ cd cmake-3.30.0
$ ./configure
$ make
$ sudo make install
$ cmake --version
3、检查cmake版本
$ cmake --version
cmake version 3.30.0
参考:
https://blog.csdn.net/weixin_42156097/article/details/126932003
