diff --git a/CMakeLists.txt b/CMakeLists.txt index dbf0999ce..6d74709a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -538,6 +538,7 @@ if (NOT CMAKE_VERSION VERSION_LESS 3.0) # Imported target support add_library (eigen INTERFACE) + add_library (Eigen3::Eigen ALIAS eigen) target_compile_definitions (eigen INTERFACE ${EIGEN_DEFINITIONS}) target_include_directories (eigen INTERFACE diff --git a/cmake/Eigen3Config.cmake.in b/cmake/Eigen3Config.cmake.in index c5c546887..0a1ac61c9 100644 --- a/cmake/Eigen3Config.cmake.in +++ b/cmake/Eigen3Config.cmake.in @@ -3,7 +3,9 @@ @PACKAGE_INIT@ -include ("${CMAKE_CURRENT_LIST_DIR}/Eigen3Targets.cmake") +if (NOT TARGET eigen) + include ("${CMAKE_CURRENT_LIST_DIR}/Eigen3Targets.cmake") +endif () # Legacy variables, do *not* use. May be removed in the future.