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
12 changes: 11 additions & 1 deletion cmake/modules/FindEigen3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,17 @@ else ()
# the script will work as usual
# re:NO_CMAKE_PACKAGE_REGISTRY: eigen3 registers its *build* tree with the user package registry ...
# to avoid issues with wiped build directory look for installed eigen
find_package(Eigen3 ${Eigen3_FIND_VERSION} NO_MODULE QUIET NO_CMAKE_PACKAGE_REGISTRY)
# N.B. Eigen3.4 -> Eigen5 transition made versions reported in Eigen3Config useless, will check manually below
find_package(Eigen3 NO_MODULE QUIET NO_CMAKE_PACKAGE_REGISTRY)

# if found older version, reset and try to look for include path directly
if (EIGEN3_INCLUDE_DIR)
_eigen3_check_version()
if (NOT EIGEN3_VERSION_OK)
unset(Eigen3_CONFIG)
unset(EIGEN3_INCLUDE_DIR)
endif()
endif()

if(NOT EIGEN3_INCLUDE_DIR)
find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
Expand Down
18 changes: 12 additions & 6 deletions export/CMakeLists.txt.export
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,14 @@ endif()

find_package(Eigen3 MODULE)

set(LIBINT2_CXX_STANDARD 11)
if (TARGET Eigen3::Eigen)
set(LIBINT_HAS_EIGEN 1)
# Eigen 3.5+ (a.k.a. Eigen 5) requires C++14
if (EIGEN3_VERSION VERSION_GREATER_EQUAL "3.5.0")
set(LIBINT2_CXX_STANDARD 14)
message(STATUS "Eigen ${EIGEN3_VERSION} requires C++14; setting LIBINT2_CXX_STANDARD=14")
endif()
endif()
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")
Expand Down Expand Up @@ -231,7 +237,7 @@ add_library(
target_compile_features(
int-obj
PUBLIC
"cxx_std_11" # N.B. PUBLIC to make int-{static/shared} require C++11
"cxx_std_${LIBINT2_CXX_STANDARD}" # N.B. PUBLIC to make int-{static/shared} require C++11 (or C++14 for Eigen 5.x)
)
target_compile_definitions(
int-obj
Expand Down Expand Up @@ -268,7 +274,7 @@ if (LIBINT2_REQUIRE_CXX_API_COMPILED)
target_compile_features(
int-cxx-obj
PUBLIC
"cxx_std_11"
"cxx_std_${LIBINT2_CXX_STANDARD}"
)
target_compile_definitions(
int-cxx-obj
Expand Down Expand Up @@ -336,7 +342,7 @@ if (L2_BUILD_SHARED_LIBS)
target_compile_features(
int-shared
INTERFACE
"cxx_std_11"
"cxx_std_${LIBINT2_CXX_STANDARD}"
)
target_compile_definitions(
int-shared
Expand Down Expand Up @@ -386,7 +392,7 @@ if (L2_BUILD_SHARED_LIBS)
target_compile_features(
int-cxx-headeronly-shared
INTERFACE
"cxx_std_11"
"cxx_std_${LIBINT2_CXX_STANDARD}"
)
target_compile_definitions(
int-cxx-headeronly-shared
Expand Down Expand Up @@ -467,7 +473,7 @@ if (L2_BUILD_STATIC_LIBS)
target_compile_features(
int-static
INTERFACE
"cxx_std_11"
"cxx_std_${LIBINT2_CXX_STANDARD}"
)
target_compile_definitions(
int-static
Expand Down Expand Up @@ -510,7 +516,7 @@ if (L2_BUILD_STATIC_LIBS)
target_compile_features(
int-cxx-headeronly-static
INTERFACE
"cxx_std_11"
"cxx_std_${LIBINT2_CXX_STANDARD}"
)
target_compile_definitions(
int-cxx-headeronly-static
Expand Down
Loading