Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion cmake/modules/FindEigen3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
26 changes: 25 additions & 1 deletion cmake/modules/int_checkboost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<BUILD_INTERFACE:...> generator expressions
string(REGEX MATCHALL "\\$<BUILD_INTERFACE:([^>]+)>" _build_interface_matches "${_interface_include_dirs}")
foreach(_match IN LISTS _build_interface_matches)
string(REGEX REPLACE "\\$<BUILD_INTERFACE:([^>]+)>" "\\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("
Expand Down
2 changes: 1 addition & 1 deletion doc/wiki
Submodule wiki updated from d0057d to 6ce8b9
2 changes: 1 addition & 1 deletion export/CMakeLists.txt.export
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Loading