I'm happy Eigen has started supporting the Find_package(Eigen3 CONFIG) mode by including an Eigen3Config.cmake file. It wold be nice if it also provided an IMPORTED target like Alain suggests in Bug #1319. Howevever, EIGEN3_INCLUDE_DIR points to the absolute location of CMAKE_INSTALL_PREFIX when 'make install' was called. Thus not making the install dir relocatable. A more convenient solution would be to set a relative PATH like this: <set ( EIGEN3_INCLUDE_DIR "@EIGEN_INCLUDE_DIR@" ) <set ( EIGEN3_ROOT_DIR "@EIGEN_ROOT_DIR@" ) --- >get_filename_component(EIGEN3_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE) >set ( EIGEN3_INCLUDE_DIR "${EIGEN3_ROOT_DIR}/include/eigen3" ) There is a also a new fancy syntax to achieve this described here: https://cmake.org/cmake/help/git-master/manual/cmake-packages.7.html#creating-relocatable-packages
Thanks a lot for the suggestion. There is a pull-request implementing imported targets using the new syntax with fallback: https://bitbucket.org/eigen/eigen/pull-requests/255/cmake-added-eigen3-eigen-imported-target It would be very helpful if you could quickly review it to assess it properly cover your issue.
https://bitbucket.org/eigen/eigen/pull-requests/267
-- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1347.