출처

CMAKE 업그레이드 하기

빌드하려고 보니 ubuntu 20.04에 기본 설치된 cmake 버전이 이전 버전이라 설치가 안된다.

$ cmake ..
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
  CMake 3.18 or higher is required.  You are running version 3.16.3

-- Configuring incomplete, errors occurred!

현재 3.16.3 버전이 설치되어있다.

$ cmake --version
cmake version 3.16.3apt upgrade 만으로는 업그레이드가 되지 않는다

그렇다고 새 버전을 설치하기 위해 apt install remove cmake를 하면 다른 ROS 패키지들도 같이 삭제가 된다.

$ sudo apt purge cmake
[sudo] password for khyou:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  cmake-data fonts-lato gazebo11 gazebo11-common gazebo11-plugin-base
  graphicsmagick-libmagick-dev-compat ignition-tools libamd2 libasound2-dev
  여러가지 lib 패키지 등등등...
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  cmake* libgazebo11-dev* libignition-cmake2-dev* libignition-common3-av-dev*
  libignition-common3-core-dev* libignition-common3-dev*
  ros-foxy-action-tutorials-cpp* ros-foxy-action-tutorials-interfaces*
  ros-foxy-action-tutorials-py* ros-foxy-actionlib-msgs* ros-foxy-ament-cmake*
  **등등등
  ros-foxy-*
  ros-foxy-visualization-msgs*
0 upgraded, 0 newly installed, 283 to remove and 21 not upgraded.
After this operation, 497 MB disk space will be freed.
Do you want to continue? [Y/n] n

그래서 검색해본 결과 아래와 같은 해결책이 있다.

https://answers.ros.org/question/293119/how-can-i-updateremove-cmake-without-partially-deleting-my-ros-distribution/

How can I update/remove cmake without partially deleting my ROS distribution? - ROS Answers: Open Source Q&A Forum

먼저 https://cmake.org/download/ 로 이동하여 cmake 최신 버전을 다운로드한다.

다운받은 cmake-3.xx.tar.gz 파일을 압축해재하고 해당 디렉토리로 이동하여 다음과 같이 빌드 인스톨 한다.