CMake cannot find my Eigen3 package. I set an environment variable called
EIGEN3_INCLUDE_DIR
pointing to the path where FindEigen3.cmake is.
Then in the CMakelists.txt I wrote:
find_package( Eigen3 REQUIRED )
include_directories( EIGEN3_INCLUDE_DIR )
I get next message of error:
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
Could NOT find Eigen3 (missing: EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
(Required is at least version "2.91.0")
Call Stack (most recent call first):
C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindEigen3.cmake:76 (find_package_handle_standard_args)
test/test_quaternion/CMakeLists.txt:25 (find_package)
Any idea on what I am missing or doing wrong?
Since Eigen3 is completely header only, all you ever need is the path to the include directory. And this one, you are already defining manually anyway. So there is no real need for a
FindEigen3.cmakeorFIND_PACKAGEcall.Simply use
or
A few notes:
${...}$ENV{....}accesses environment variables.CMAKE_MODULE_PATHto the directory where it is. Not sure, but it could be that CMake checks the current directory as well automatically (where yourCMakeLists.txtresides. Anyhow, settingEIGEN3_INCLUDE_DIRis totally unrelated to the location ofFindEigen3.cmakeFindEigen3script evaluates this variable to determine the location of your Eigen3 installation.<PackageName>Config.cmake. If you point a variable called<PackageName>_DIRto the directory containing this file, you can useFIND_PACKAGE( <PackageName> ...)as normal. See documentation of FIND_PACKAGE for details.