Use modern-style Eigen3 CMake variables

Change-Id: I4c14aa54552b3f718dff90eb397cb030aeb6ecd4
This commit is contained in:
Alex Stewart
2021-11-16 19:51:06 +00:00
parent 2fba61434b
commit 8d3e64dd5e
2 changed files with 10 additions and 10 deletions
+3 -3
View File
@@ -239,8 +239,8 @@ message("-- Building with C++${CMAKE_CXX_STANDARD}")
# Eigen.
# Eigen delivers Eigen3Config.cmake since v3.3.3
find_package(Eigen3 3.3 REQUIRED)
if (EIGEN3_FOUND)
message("-- Found Eigen version ${Eigen3_VERSION}: ${EIGEN3_INCLUDE_DIRS}")
if (Eigen3_FOUND)
message("-- Found Eigen version ${Eigen3_VERSION}: ${Eigen3_DIR}")
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)" AND
Eigen3_VERSION VERSION_LESS 3.3.4)
# As per issue #289: https://github.com/ceres-solver/ceres-solver/issues/289
@@ -258,7 +258,7 @@ if (EIGEN3_FOUND)
message(" which can still use the EIGEN_SPARSE_QR algorithm.")
add_definitions(-DEIGEN_MPL2_ONLY)
endif (EIGENSPARSE)
endif (EIGEN3_FOUND)
endif (Eigen3_FOUND)
if (LAPACK)
find_package(LAPACK QUIET)
+7 -7
View File
@@ -187,30 +187,30 @@ find_dependency(Threads)
# Eigen.
# Flag set during configuration and build of Ceres.
set(CERES_EIGEN_VERSION @EIGEN3_VERSION_STRING@)
set(CERES_EIGEN_VERSION @Eigen3_VERSION@)
# Search quietly to control the timing of the error message if not found. The
# search should be for an exact match, but for usability reasons do a soft
# match and reject with an explanation below.
find_package(Eigen3 ${CERES_EIGEN_VERSION} QUIET)
if (EIGEN3_FOUND)
if (NOT EIGEN3_VERSION_STRING VERSION_EQUAL CERES_EIGEN_VERSION)
if (Eigen3_FOUND)
if (NOT Eigen3_VERSION VERSION_EQUAL CERES_EIGEN_VERSION)
# CMake's VERSION check in FIND_PACKAGE() will accept any version >= the
# specified version. However, only version = is supported. Improve
# usability by explaining why we don't accept non-exact version matching.
ceres_report_not_found("Found Eigen dependency, but the version of Eigen "
"found (${EIGEN3_VERSION_STRING}) does not exactly match the version of Eigen "
"found (${Eigen3_VERSION}) does not exactly match the version of Eigen "
"Ceres was compiled with (${CERES_EIGEN_VERSION}). This can cause subtle "
"bugs by triggering violations of the One Definition Rule. See the "
"Wikipedia article http://en.wikipedia.org/wiki/One_Definition_Rule "
"for more details")
endif ()
ceres_message(STATUS "Found required Ceres dependency: "
"Eigen version ${CERES_EIGEN_VERSION} in ${EIGEN3_INCLUDE_DIRS}")
else (EIGEN3_FOUND)
"Eigen version ${CERES_EIGEN_VERSION} in ${Eigen3_DIR}")
else (Eigen3_FOUND)
ceres_report_not_found("Missing required Ceres "
"dependency: Eigen version ${CERES_EIGEN_VERSION}, please set "
"Eigen3_DIR.")
endif (EIGEN3_FOUND)
endif (Eigen3_FOUND)
# glog (and maybe gflags).
#