Wrong CMake version being applied for cmake-gui

On Ubuntu 18.04, I had CMake 3.10.2 installed (in /usr/bin). Following instructions on the kitware.com website, I was able to update CMake to 3.13.5. The 3.13.5 binaries are installed in /usr/local/bin/cmake. The original cmake, cpack and ctest binaries (in /usr/bin) were renamed to “cmake-3.10.2” (etc).

Now when I run CMake manually from the command-line, with this line in CMakeLists.txt:
message(STATUS “Version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} is installed”

The diagnostics message correctly shows that 3.13.5 is installed.

OK, great. But when I try and run the cmake-gui application, the title bar says “CMake 3.10.2”. What is going on? Was a different version of CMake bundled with the cmake-gui I installed? Is it pointing to the /usr/bin/cmake-3.10.2 binary?

If you run which cmake-gui it will tell yout what specific executable you are running. That should help you track down why you are still running the 3.10 version.

The GUI runs an internal copy of CMake (all the tools are statically linked to the implementation details). It doesn’t rely on an external CMake binary at all (same with ccmake for that matter).

Ah, then if I understand you correctly, the GUI actually is running CMake 3.10.2. Since the GUI is statically linked, there surely won’t be any easy method for to dynamically use installed 3.13.5 CMake…correct me if this is wrong.

And given that…is there a version of the GUI statically linked to 3.13.5?

All the downloads from https://cmake.org/download come with the corresponding version of cmake-gui.

which cmake-gui returns /usr/bin/cmake-gui, though I don’t this helps. As Ben Boeckel points out, cmake-gui is statically linked to an internal version of CMake (and does not use the system-installed version).

This is unfortunate and also a little weird - why not produce one version of cmake-gui and allow the GUI to dynamically use the installed version of CMake. This would allow the user to upgrade CMake separately from the GUI.

CMake doesn’t offer a dynamic library on purpose as we don’t want to maintain the level of exposed API. Updating CMake on most machine means you will need to replace all associated binaries ( cmake, ctest, cpack, ccmake, cmake-gui ).

Because then CMake would have to have some API for UIs to use to do what it does. This currently doesn’t exist because that’s not a stability boundary we’re willing to commit to.

1 Like

OK, thanks Ben, Rob…