I am kind of desperate: For my studies I need to work with Eigen and CMake. I\'m able to use Eigen if I copy the whole library in the directories where my compiler looks by
Turning my comment into an answer
The find package scripts - like FindEigen3.cmake
- normally use the find_path()
command to detect the package's include directory (see it's documentation for the full details).
FindEigen3.cmake
uses the following code snippet:
find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library PATHS ${CMAKE_INSTALL_PREFIX}/include ${KDE4_INCLUDE_DIR} PATH_SUFFIXES eigen3 eigen )
So it looks in CMAKE_INSTALL_PREFIX which on Unix/Linux hosts is /usr/local
by default.
The following has worked for me:
Go to the Eigen
source directory and run the CMake and installation steps
> mkdir build
> cd build
> cmake ..
> make install
Then copy - as you have done - FindEigen3.cmake
to your projects source directory.
Now your code does find Eigen
(just changed to list(APPEND ...)
)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
find_package(Eigen3 REQUIRED)
References
Add the path of FindEigen3.cmake
before find_package(Eigen3 REQUIRED)
, like this:
LIST(APPEND CMAKE_MODULE_PATH "/usr/share/cmake-2.8/Modules/")
find_package(Eigen3)