ubuntu18安装cmake27的方法

背景是ubuntu18默认的cmake是3.10

$ apt search cmake 

Sorting... Done
Full Text Search... Done
bear/bionic,bionic 2.3.11-1 all
  generate compilation database for Clang tooling

catkin/bionic,bionic 0.7.8-1 all
  Low-level build system macros and infrastructure for Robot OS

cmake/bionic-updates,now 3.10.2-1ubuntu2.18.04.2 amd64 [installed]
  cross-platform, open-source make system

3.10 没有 target_link_directories 所以我想升级到3.27版本。

升级方法

step 1 从官网下载Binary distributions

https://cmake.org/download/

https://github.com/Kitware/CMake/releases/download/v3.27.4/cmake-3.27.4-linux-x86_64.tar.gz

step 2

tar -zxvf cmake-3.27.4-linux-x86_64.tar.gz
mv cmake-3.27.4-linux-x86_64 /usr/local
export PATH=/usr/local/cmake-3.27.4-linux-x86_64/bin:$PATH

step 3

$ cmake --version
cmake version 3.27.4

CMake suite maintained and supported by Kitware (kitware.com/cmake).

你可能感兴趣的:(C/C++,c++)