Unbuntu 升级cmake

308 阅读1分钟

编译时出现问题

[cmake] CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
[cmake]   CMake 3.26 or higher is required.  You are running version 3.25.1

需要升级cmake

官网下载 地址

发现最新版本为3.28版本 下载.sh文件

image.png

升级版本

升级命令

cd Downloads
sudo bash cmake-3.28.0-linux-x86_64.sh --skip-licence --prefix=/usr

接下来按照提示选择第一个选择y 第二个选择n

Do you accept the license? [yn]: 
y
By default the CMake will be installed in:
  "/usr/cmake-3.28.0-linux-x86_64"
Do you want to include the subdirectory cmake-3.28.0-linux-x86_64?
Saying no will install in: "/usr" [Yn]: 
n
Using target directory: /usr
Extracting, please wait...
Unpacking finished successfully

升级完成

检查版本号

cmake --version

image.png