Issue
I want to update my CMake version (from 3.16.3 to 3.27.7) in my Ubuntu Linux environment without affecting the current ROS2 galactic installation. I installed the latest CMake version from this link : https://cmake.org/download/ and I installed from latest release 3.27.7 and from Linux x86_64 the .sh version. But since ROS2 galactic has a pre-installed CMake distribution deleting version 3.16.3 means that the whole ROS2 distribution will also be deleted. So I need a way to apply 3.27.7 version to my system without losing ROS2.
I did a little search on the web but did not find anything similar.
The only link I found was this one : https://answers.ros.org/question/293119/how-can-i-updateremove-cmake-without-partially-deleting-my-ros-distribution/ but it uses ./bootstrap
this command while this file does not exist in order to execute it. So this solution does not work.
I also asked ChatGPT the same question but the answer it gave me either did not manage to aplly the newest version or it applied an incomplete version of CMake without applying all it's features and when i did cmake --version
I got this error : CMake Error: Could not find CMAKE_ROOT !!! CMake has most likely not been installed correctly. Modules directory not found in
.
So my question is how can I do have the latest CMake version (3.27.7) without affecting my ROS2 galactic disribution.
Thanks!
Solution
Modify the PATH. Here is an example of how you can do this with bash:
PATH="~/Downloads/cmake/3.27.3/bin:$PATH"
export PATH
The important thing is I am pre-pending
to the PATH
to ensure my version of CMake is found first.
If you need the change to persist add the above code to .bashrc
or .bash_aliases
or .bash_profile
whichever you prefer.
Answered By - jpr42 Answer Checked By - Senaida (WPSolving Volunteer)