Eigen3 makes use of the cmake user package registry through the cmake command "export(PACKAGE ...)". This command registers the Eigen3Config.cmake from *the build tree*. However, the relative paths currently used in this config file are designed to be correct within *the installation tree structure*. This results in CMake finding Eigen3 form downstream packages, but use incorrect include paths.
Note, that the behaviour was explicitly changed to relative paths in #1347.
Some bits of discussions there: https://bitbucket.org/eigen/eigen/commits/52399ea56fa9e936bd936e47c8a356265ecbfa92#LCMakeLists.txtT545
I will try to submit a PR on bitbucket to address this bug. Here is what I said in an email to email@example.com:
I believe the issue is that the build directory has an Eigen3Config.cmake file in it; the configured file in the build directory should be named something else so that CMake does not pick it up. For example, in my project, we name the configured build-directory file “OpenSimConfigToInstall.cmake”: https://github.com/opensim-org/opensim-core/blob/master/cmake/CMakeLists.txt#L12. This resolved the issue for us.
I recently ran into this as well, when a library used
find_package(Eigen3 3.0.5 QUIET CONFIG)
and accidentally picked up a local Eigen3Config.cmake from a version which had some experimental (not yet working) changes.
In my eyes this PR is good:
But I'm not really a CMake expert, so I have no idea, whether one should or should not do:
export (PACKAGE Eigen3)
-- 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/1386.