I'm trying to build a github project using cmake and I've been having a lot of trouble. I'm creating a build directory and calling cmake like so:
cd github_project_directory
mkdir build
cd build
cmake ..
This is the error I'm getting:
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/bin
CMake Error: Error executing cmake::LoadCache(). Aborting.
I think there is a problem with how cmake is installed but I can't seem to figure it out. I've tried uninstalling and reinstalling but...I think it might have created even more trouble.
I'm on Ubuntu 14.04. Happy to provide more information as required.
Thank you!
I was getting the same error for anything cmake, including
cmake --version
, and the "reinstallcmake
andcmake-data
, then restart your shell" answers didn't work, so I tried manually settingCMAKE_ROOT
to the path fromdpkg -L cmake-data
that contains theModules
directory.That got
cmake --version
working, which revealed that I was somehow dealing with acmake
that reported itself as cmake 2.x, but acmake-data
package which created acmake-3.5
folder for its resources.It turned out that one of my PPAs was offering cmake 3.5 at the same package names that 14.04 uses for cmake 2.8 and, because of a dependency conflict, the
cmake-data
package had upgraded to 3.5, but thecmake
package was getting held back at 2.8.The following lines got things working for me:
I had to re-install my cmake to correct this same error.
Then be sure to re-source your rc.
You could use the version from pip
pip install cmake
Runing
. ~/.bashrc
also solved the problem for me. My total procedure was -