CMake fixes for Eigen3 5.0.0
Hello @artivis, I hope everything is fine!
Eigen3 5.0.0 was recently released, and this PR fixes the CMake logic of manif to permit to use it out of the box, with the following modifications:
- The current logic of "trying to find Eigen with a CMake Config and then fallback to the built-in FindEigen3.cmake module" was actually broken, as it checked for
EIGEN3_FOUNDvariable instead of theEigen3_FOUNDvariable actually set byfind_package(Eigen3 QUIET). However, this was never a problem as the built-in module worked fine for Eigen3 versions <= 3.4.0. However, now the built-inFindEigen3.cmakedoes not work anymore fine for Eigen3 >= 5.0.0, so avoiding that is invoked if not necessary is important. - Eigen3 5.0.0 does not define anymore
EIGEN3_VERSION_STRINGandEIGEN3_INCLUDE_DIRSCMake variables, see https://github.com/eigen-mirror/eigen/blob/5.0.0/cmake/Eigen3Config.cmake.in vs https://github.com/eigen-mirror/eigen/blob/3.4.1/cmake/Eigen3Config.cmake.in . Fortunately, such variables were just used to check if the Eigen3 version was either ==3.3.6 or <=3.3.8, and those are checks we can avoid if we know that Eigen3>=5.0.0
As a related note, I think all non-EOL distributions of Eigen actually ship a well formed Eigen3Config.cmake file, so it could make sense to drop the internal FindEigen3.cmake, but that is not strictly related to this PR.
xref: https://github.com/robotology/robotology-superbuild/issues/1902 xref: https://github.com/robotology/robotology-superbuild/issues/1903 xref: https://github.com/conda-forge/eigen-feedstock/pull/47
The CI failure is not related to this PR, it is an upstream vcpkg issue tracked in https://github.com/microsoft/vcpkg/issues/47599 that will be fixed by https://github.com/microsoft/vcpkg/pull/47620 .