cmake: Cannot find installed modules on OS X
I'm flabbergasted, and I hope someone can point me in the right direction.
The find_package
documentation states that the following folders are searched for a configuration file (limiting list to the Unix convention paths):
<prefix>/(lib/<arch>|lib|share)/cmake/<name>*/ (U)
<prefix>/(lib/<arch>|lib|share)/<name>*/ (U)
<prefix>/(lib/<arch>|lib|share)/<name>*/(cmake|CMake)/ (U)
I compiled and installed the latest CMake (3.6.1) manually to /opt/cmake. Now, I wanted to use Eigen 3 from my CMake script, which looks like:
cmake_minimum_required(VERSION 3.1)
project(CMakeTesting)
find_package(Eigen3 REQUIRED)
I installed Eigen's FindEigen3.cmake file to /opt/cmake/share/eigen3/
but running my script yields the error:
By not providing "FindEigen3.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Eigen3", but
CMake did not find one.
<snip>
I tried several other locations based on the find_package documentation (e.g., /usr/local/share/eigen3
or /opt/cmake/share/eigen3/cmake
) but nothing worked, until I put FindEigen3.cmake into /opt/cmake/share/cmake-3.6/Modules
.
Any suggestions? Is find_package
not working as documented on OS X?
In case it matters, I'm on OS X 10.11.6. Note that this is also causing problems with the homebrew installed CMake (hence why I tried a manual compile/install).
Thanks!