Merged in alainvaucher/eigen/find-module-imported-target (pull request PR-324) In the CMake find module, define the Eigen imported target as when installing with CMake * In the CMake find module, define the Eigen imported target * Add quotes to the imported location, in case there are spaces in the path. Approved-by: Alain Vaucher <acvaucher@gmail.com>
diff --git a/cmake/FindEigen3.cmake b/cmake/FindEigen3.cmake index 9e96978..657440b 100644 --- a/cmake/FindEigen3.cmake +++ b/cmake/FindEigen3.cmake
@@ -10,6 +10,10 @@ # EIGEN3_INCLUDE_DIR - the eigen include directory # EIGEN3_VERSION - eigen version # +# and the following imported target: +# +# Eigen3::Eigen - The header-only Eigen library +# # This module reads hints about search locations from # the following enviroment variables: # @@ -95,3 +99,8 @@ endif(EIGEN3_INCLUDE_DIR) +if(EIGEN3_FOUND AND NOT TARGET Eigen3::Eigen) + add_library(Eigen3::Eigen INTERFACE IMPORTED) + set_target_properties(Eigen3::Eigen PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${EIGEN3_INCLUDE_DIR}") +endif()