New user self-registration is currently disabled. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 1346 - CMake Install uses absolute paths in FindEigen3.cmake
CMake Install uses absolute paths in FindEigen3.cmake
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: General
unspecified
All All
: Normal Compilation Problem
Assigned To: Nobody
:
Depends on:
Blocks: 3.3
  Show dependency treegraph
 
Reported: 2016-11-21 07:54 UTC by Clemens Arth
Modified: 2016-12-06 10:36 UTC (History)
5 users (show)



Attachments
Patch for Eigen 3.3.0 CMakeLists.txt file (919 bytes, patch)
2016-11-21 07:54 UTC, Clemens Arth
no flags Details | Diff

Description Clemens Arth 2016-11-21 07:54:15 UTC
Created attachment 752 [details]
Patch for Eigen 3.3.0 CMakeLists.txt file

I encountered a serious issue with the current CMakeLists.txt version, that is shipped with Eigen.

The install target is configured to use the ABSOLUTE paths of the install directory and to put that inside FindEigen3.cmake. This means that whatever you install Eigen to, the install folder might not be moved - this is a serious issue if you do continuous integration for example, where you build Eigen in one repo and your own project in an other repo for example. Because even if you tar the install folder, move it, and untar it again, AND you use your project to find Eigen with cmake, everything is messed up.

For example, 
1) you build Eigen temporarily into 
/tmp/eigen/eigen_install
2) you tar eigen_install into eigen_install.tgz
3) you build some other project, say /tmp/myproject 
4) you untar eigen_install.tgz into
/tmp/myproject/3rdparty

Whatever you do to find Eigen with CMake, it will not work, as in the FindEigen3.cmake you have INCLUDE_DIRS set to /tmp/eigen/eigen_install/include/eigen3, but it should be {DIR_OF_FindEigen3.cmake}/../../../include/eigen3

I attached a patch against the 3.3.0 CMakeLists.txt file that should work out.
Comment 1 Björn Piltz 2016-11-22 10:36:51 UTC
I missed this issue when I reported Bug #1347. My fix is slightly different.
Comment 2 Gael Guennebaud 2016-11-23 10:41:41 UTC
Yes I agree there is a big issue here.

There is a pull-request implementing imported targets with other cmake fixes: 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 3 Silvio Traversaro 2016-12-05 09:53:06 UTC
I implemented a fix for this issue without hardcoding the relative value of CMAKECONFIG_INSTALL_DIR in https://bitbucket.org/eigen/eigen/pull-requests/267/make-cmake-config-file-relocatable/diff .
Comment 4 Gael Guennebaud 2016-12-06 10:36:47 UTC
Fixed by merging 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.