Could not find CMAKE_ROOT

When I envoke cmake I get this error:

CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.

I use cmake version 3.10.2 on Xubuntu 18.04 64bit.

What can I do?


It sounds like you’ve moved the cmake executable out of its installation tree. It needs to be kept in the same directory structure as ctest, cpack, ccmake, cmake-gui, and its Modules and Templates directory.

Is this the case?

No. But I have cmake both in /bin and in /usr/bin. This is probably a wrong thing.
I had just installed cmake 3.16.something and cmake --version tells me it is still cmake 3.10.something. I think I messed up the installation somehow.
Any chance to correct this?


Please type the output of the following:

which cmake

The output is:

What installation method did you use to install 3.10 and 3.16?

3.10 was already installed on OS installation or unnotieced as a dependency (via APT).
3.16 was downloaded form and I followed the instructons there (If I remember correctly: ./bootstrap && make && sudo make install)

Please post the output of the following:

ls /usr/local/share/cmake-3.16/Modules/CMake.cmake

The output is:

ls /usr/share/cmake-3.10/Modules/CMake.cmake

The output is:

Hmmm. So both installations appear to be valid.

How did you get CMake into /bin? Did you manually copy it in there? /bin/cmake may be the one that’s causing issues.

Yes I copied it there by hand. :frowning:

Please delete /bin/cmake. There’s no reason for it to live in /bin, and it’s failing because it can’t find its module files (it’s looking in /share/cmake-3.10/Modules, which obviously doesn’t exist.)

Also, we have our own APT repository which always hosts the latest CMake builds for Ubuntu. We even publish the release candidates as an optional add-on. This would probably be easier than managing the installation yourself :slight_smile:

Yes that would certainly be easier. I will go there.
I deleted /bin/cmake. Any other program to delete? maybe /bin/ctest and whatelse?


  • /bin/cmake
  • /bin/ctest
  • /bin/cpack
  • /bin/ccmake
  • /bin/cmake-gui

Ander deleting those files I took the APT package and now it works fine with 3.16 without error.
Is it possible to mark this thread as “Solved”?

Yes, I will do so.

Also, you may want to remove the CMake installation from /usr/local - it may be shadowing the “correct” one in /usr.