- (Optional, careful) First uninstall the original cmake[1]:
sudo apt remove cmake
- Go to the official website to download the corresponding version. You can choose binary version or source installation, here I chose
Binary Distribution
[2]: - Modify permissions and set the installation path:
chmod + x cmake-3.19.2-Linux-x86_64.sh
sudo ./cmake-3.19.2-Linux-x86_64.sh --skip-license --exclude-subdir --prefix=/usr/local
- Verify that the version is correct. If you see the following message, the update is successful.
[1] It is not necessary to uninstall the original cmake, because you can put the cmake directory in /usr/local/bin, and the newly installed cmake will be found in the environment variable; if you are still using ROS, you cannot uninstall It, because it will make the function missing.
[2] Source Distribution is a source code version, which needs to be compiled to use; Binary Distribution has compiled an executable version.
[3] If a message similar to could not find CMAKE_ROOT appears after the installation is complete, restart the terminal.