Skip to content

Commit

Permalink
Use system Eigen by default only if found
Browse files Browse the repository at this point in the history
  • Loading branch information
varunagrawal committed Jul 7, 2022
1 parent 8f509dc commit ea8e69c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cmake/HandleEigen.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
###############################################################################
# Option for using system Eigen or GTSAM-bundled Eigen

option(GTSAM_USE_SYSTEM_EIGEN "Find and use system-installed Eigen. If 'off', use the one bundled with GTSAM" OFF)
# Default: Use system's Eigen if found automatically:
find_package(Eigen3 QUIET)
set(USE_SYSTEM_EIGEN_INITIAL_VALUE ${Eigen3_FOUND})
option(GTSAM_USE_SYSTEM_EIGEN "Find and use system-installed Eigen. If 'off', use the one bundled with GTSAM" ${USE_SYSTEM_EIGEN_INITIAL_VALUE})
unset(USE_SYSTEM_EIGEN_INITIAL_VALUE)

if(NOT GTSAM_USE_SYSTEM_EIGEN)
# This option only makes sense if using the embedded copy of Eigen, it is
Expand All @@ -11,7 +14,7 @@ endif()

# Switch for using system Eigen or GTSAM-bundled Eigen
if(GTSAM_USE_SYSTEM_EIGEN)
find_package(Eigen3 REQUIRED)
find_package(Eigen3 REQUIRED) # need to find again as REQUIRED

# Use generic Eigen include paths e.g. <Eigen/Core>
set(GTSAM_EIGEN_INCLUDE_FOR_INSTALL "${EIGEN3_INCLUDE_DIR}")
Expand Down

0 comments on commit ea8e69c

Please sign in to comment.