New user self-registration is currently disabled. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 1347 - Eigen3Config.cmake contains absolut paths.
Eigen3Config.cmake contains absolut paths.
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: General
3.3 (current stable)
All All
: Normal Unknown
Assigned To: Nobody
:
Depends on:
Blocks: 3.3
  Show dependency treegraph
 
Reported: 2016-11-22 10:12 UTC by Björn Piltz
Modified: 2016-12-06 10:37 UTC (History)
3 users (show)



Attachments

Description Björn Piltz 2016-11-22 10:12:12 UTC
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
Comment 1 Gael Guennebaud 2016-11-23 10:40:21 UTC
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.
Comment 2 Gael Guennebaud 2016-12-06 10:37:02 UTC
https://bitbucket.org/eigen/eigen/pull-requests/267

Note You need to log in before you can comment on or make changes to this bug.