diff --git a/cmake/modules/FindEigen3.cmake b/cmake/modules/FindEigen3.cmake index fe82bb9f..e33a2678 100644 --- a/cmake/modules/FindEigen3.cmake +++ b/cmake/modules/FindEigen3.cmake @@ -49,7 +49,18 @@ if(NOT Eigen3_FIND_VERSION) endif() macro(_eigen3_check_version) - file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header) + # Try the Eigen 5.x location first + if(EXISTS "${EIGEN3_INCLUDE_DIR}/Eigen/Version") + file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/Version" _eigen3_version_header) + # Fall back to Eigen 3.x location + elseif(EXISTS "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h") + file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header) + else() + # Could not locate any known Eigen version header; mark version as not OK and return. + set(EIGEN3_VERSION_OK FALSE) + message(STATUS "Could not find Eigen version header under ${EIGEN3_INCLUDE_DIR}") + return() + endif() string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}") set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}") diff --git a/cmake/modules/int_checkboost.cmake b/cmake/modules/int_checkboost.cmake index 016a788c..2101efe2 100644 --- a/cmake/modules/int_checkboost.cmake +++ b/cmake/modules/int_checkboost.cmake @@ -4,7 +4,31 @@ cmake_policy(SET CMP0075 NEW) # support CMAKE_REQUIRED_LIBRARIES include(CMakePushCheckState) cmake_push_check_state() -list(APPEND CMAKE_REQUIRED_LIBRARIES Boost::headers) +if (NOT TARGET Boost::headers) + message(FATAL_ERROR "int_checkboost.cmake: can only invoke if Boost::headers is already available") +endif() +# can only link against system or IMPORTED target here +get_target_property(BOOST_HEADERS_IS_IMPORTED Boost::headers IMPORTED) +if (BOOST_HEADERS_IS_IMPORTED) + list(APPEND CMAKE_REQUIRED_LIBRARIES Boost::headers) +else() # if Boost::headers is not IMPORTED, it was built within this project, extract its properties + # Collect include directories from Boost::headers and Boost::preprocessor (for modularized Boost) + set(_boost_targets_to_check Boost::headers) + if (TARGET Boost::preprocessor) + list(APPEND _boost_targets_to_check Boost::preprocessor) + endif() + foreach(_boost_target IN LISTS _boost_targets_to_check) + get_target_property(_interface_include_dirs ${_boost_target} INTERFACE_INCLUDE_DIRECTORIES) + if (_interface_include_dirs) + # Extract paths from $ generator expressions + string(REGEX MATCHALL "\\$]+)>" _build_interface_matches "${_interface_include_dirs}") + foreach(_match IN LISTS _build_interface_matches) + string(REGEX REPLACE "\\$]+)>" "\\1" _include_dir "${_match}") + list(APPEND CMAKE_REQUIRED_INCLUDES "${_include_dir}") + endforeach() + endif() + endforeach() +endif() #list(APPEND CMAKE_REQUIRED_FLAGS "-std=c++11") # set CMAKE_CXX_STANDARD and 0067 NEW ? check_cxx_source_compiles(" diff --git a/doc/wiki b/doc/wiki index d0057dd3..6ce8b99e 160000 --- a/doc/wiki +++ b/doc/wiki @@ -1 +1 @@ -Subproject commit d0057dd3e920b01eb969e35656925d6d1cf8c80f +Subproject commit 6ce8b99e384658e973097ce1339b59d2acb64721 diff --git a/export/CMakeLists.txt.export b/export/CMakeLists.txt.export index 3c28edb4..45fb1a78 100644 --- a/export/CMakeLists.txt.export +++ b/export/CMakeLists.txt.export @@ -172,7 +172,7 @@ find_package(Eigen3 MODULE) if (TARGET Eigen3::Eigen) set(LIBINT_HAS_EIGEN 1) endif() -if (LIBINT2_REQUIRE_CXX_API AND NOT ${LIBINT_HAS_EIGEN}) +if (LIBINT2_REQUIRE_CXX_API AND NOT LIBINT_HAS_EIGEN) message(FATAL_ERROR "C++ API cannot be built without Eigen3; configure (via CMake) and install Eigen3 and add the install prefix to CMAKE_PREFIX_PATH, or add -D LIBINT2_REQUIRE_CXX_API=OFF to the CMake command line if the C++ API is not required") endif()