Install latest cmake after ROS installed
After install ROS, your cmake version would be:
'usr/bin/cmake' --version
get the result:
cmake version 3.10.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
If we use following command to install latest cmake:
$ sudo snap install cmake --classic
by default, its path would be in the /snap/bin
check it by using:
$ '/snap/bin/cmake' --version
cmake version 3.23.1
CMake suite maintained and supported by Kitware (kitware.com/cmake).
But after you check it with:
$ cmake --version
You will still get the same result:
cmake version 3.10.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
This is because, according to the Linux execution environment order:
1. /etc/environment
1. /usr/local/sbin
2. /usr/local/bin
3. /usr/sbin
4. /usr/bin
5. /sbin
6. /bin
7. /usr/games
8. /usr/local/games
9. /snap/bin
2. /etc/profile
3. /etc/bash.bashrc
4. ~/.profile
5. ~/.bashrc
So we need to link the cmake to the /usr/local/bin
using the following command:
sudo ln -s /snap/cmake/current/bin/* /usr/local/bin
After this, you will surprisingly see your cmake version has became:
$ cmake --version
cmake version 3.23.1
CMake suite maintained and supported by Kitware (kitware.com/cmake).
Reference:
Enjoy Reading This Article?
Here are some more articles you might like to read next: