I found a strange behavior with cmake
. On my computer I have two versions of Eigen
:
I have added the location of the 2. Eigen library in $PATH
.
In the CMakeFiles.txt I write
find_package(Eigen3 3.3.3 REQUIRED)
if (NOT Eigen3_FOUND)
MESSAGE( STATUS "Eigen not found.")
endif(NOT Eigen3_FOUND)
MESSAGE( STATUS "EIGEN_DIR: " ${Eigen3_INCLUDE_DIR})
but it outputs the following:
-- Found Eigen3: /home/armena/armena/eigen3 (Required is at least version "3.3.3")
-- Eigen not found.
-- EIGEN_DIR:
From what I understand it finds the library but it is not able to return its location. Any idea how to fix this? Thanks
The problem is that Eigen's package config file does not follow CMake's recommended naming guidelines; all of its variables are prefixed with EIGEN3_
, not with Eigen3_
. If you change your CMakeList like this, it should work:
if (NOT EIGEN3_FOUND)
message( STATUS "Eigen not found.")
endif()
message( STATUS "EIGEN_DIR: " ${EIGEN3_INCLUDE_DIR})