CMake missing modules directory

I've installed CMake 2.8.11.2 package from CMake's website for Mac 64-bit. We recently upgraded a project from Qt 4 to Qt 5 and the CMake upgrade is mandatory for CMake to use Qt 5. However, when I type cmake . I get the following error:

CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/Applications/CMake 2.8-11.app/Contents/bin
CMake Error: Error executing cmake::LoadCache(). Aborting.

I can confirm, there is no modules directory in the bin folder. I really don't know how to resolve this error, or how to get the modules needed.


Solution 1:

Do hash -r to clear the cache, then do cmake --version.

It should work.

Solution 2:

I had the same problem after upgrading on Ubuntu. Removing cmake and the cmake-data package before performing the update solved it for me.

sudo apt-get remove cmake cmake-data

Now perform the update via

sudo -E add-apt-repository -y ppa:george-edison55/cmake-3.x
sudo -E apt-get update
sudo apt-get install cmake