Clean up version finding in HandleEigen
							parent
							
								
									885959a36b
								
							
						
					
					
						commit
						3d23152a75
					
				|  | @ -13,12 +13,6 @@ if(GTSAM_USE_SYSTEM_EIGEN) | |||
|     # Since Eigen 3.3.0 a Eigen3Config.cmake is available so use it. | ||||
|     find_package(Eigen3 CONFIG REQUIRED) # need to find again as REQUIRED | ||||
| 
 | ||||
|     # The actual include directory (for BUILD cmake target interface): | ||||
|     # Note: EIGEN3_INCLUDE_DIR points to some random location on some eigen | ||||
|     # versions.  So here I use the target itself to get the proper include | ||||
|     # directory (it is generated by cmake, thus has the correct path) | ||||
|     get_target_property(GTSAM_EIGEN_INCLUDE_FOR_BUILD Eigen3::Eigen INTERFACE_INCLUDE_DIRECTORIES) | ||||
| 
 | ||||
|     # check if MKL is also enabled - can have one or the other, but not both! | ||||
|     # Note: Eigen >= v3.2.5 includes our patches | ||||
|     if(EIGEN_USE_MKL_ALL AND (EIGEN3_VERSION VERSION_LESS 3.2.5)) | ||||
|  | @ -30,6 +24,8 @@ if(GTSAM_USE_SYSTEM_EIGEN) | |||
|     if(EIGEN_USE_MKL_ALL AND (EIGEN3_VERSION VERSION_EQUAL 3.3.4)) | ||||
|         message(FATAL_ERROR "MKL does not work with Eigen 3.3.4 because of a bug in Eigen. See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1527. Disable GTSAM_USE_SYSTEM_EIGEN to use GTSAM's copy of Eigen, disable GTSAM_WITH_EIGEN_MKL, or upgrade/patch your installation of Eigen.") | ||||
|     endif() | ||||
|      | ||||
|     set(GTSAM_EIGEN_VERSION "${EIGEN3_VERSION}") | ||||
| else() | ||||
|     # Use bundled Eigen include path. | ||||
|     # Clear any variables set by FindEigen3 | ||||
|  | @ -46,7 +42,7 @@ else() | |||
| 
 | ||||
|     add_library(gtsam_eigen3 INTERFACE) | ||||
| 
 | ||||
|     target_include_directories(gtsam_eigen3 INTERFACE | ||||
|     target_include_directories(gtsam_eigen3 SYSTEM INTERFACE | ||||
|       $<BUILD_INTERFACE:${GTSAM_EIGEN_INCLUDE_FOR_BUILD}> | ||||
|       $<INSTALL_INTERFACE:${GTSAM_EIGEN_INCLUDE_FOR_INSTALL}> | ||||
|     ) | ||||
|  | @ -56,11 +52,8 @@ else() | |||
| 
 | ||||
|     list(APPEND GTSAM_EXPORTED_TARGETS gtsam_eigen3) | ||||
|     set(GTSAM_EXPORTED_TARGETS "${GTSAM_EXPORTED_TARGETS}") | ||||
| endif() | ||||
| 
 | ||||
| # Detect Eigen version: | ||||
| set(EIGEN_VER_H "${GTSAM_EIGEN_INCLUDE_FOR_BUILD}/Eigen/src/Core/util/Macros.h") | ||||
| if (EXISTS ${EIGEN_VER_H}) | ||||
|     # Detect Eigen version: | ||||
|     set(EIGEN_VER_H "${GTSAM_EIGEN_INCLUDE_FOR_BUILD}/Eigen/src/Core/util/Macros.h") | ||||
|     file(READ "${EIGEN_VER_H}" STR_EIGEN_VERSION) | ||||
| 
 | ||||
|     # Extract the Eigen version from the Macros.h file, lines "#define EIGEN_WORLD_VERSION  XX", etc... | ||||
|  | @ -75,11 +68,9 @@ if (EXISTS ${EIGEN_VER_H}) | |||
|     string(REGEX MATCH "[0-9]+" GTSAM_EIGEN_VERSION_MINOR "${GTSAM_EIGEN_VERSION_MINOR}") | ||||
| 
 | ||||
|     set(GTSAM_EIGEN_VERSION "${GTSAM_EIGEN_VERSION_WORLD}.${GTSAM_EIGEN_VERSION_MAJOR}.${GTSAM_EIGEN_VERSION_MINOR}") | ||||
| endif() | ||||
| 
 | ||||
|     message(STATUS "Found Eigen version: ${GTSAM_EIGEN_VERSION}") | ||||
| else() | ||||
|     message(WARNING "Cannot determine Eigen version, missing file: `${EIGEN_VER_H}`") | ||||
| endif () | ||||
| message(STATUS "Found Eigen version: ${GTSAM_EIGEN_VERSION}") | ||||
| 
 | ||||
| if (MSVC) | ||||
|     if (GTSAM_SHARED_LIB) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue