Skip to content

Commit

Permalink
Eigen search is more robust, checks for false-positives. Resolves #158
Browse files Browse the repository at this point in the history
  • Loading branch information
evaleev committed Jan 29, 2020
1 parent e88cba1 commit 969cc73
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Following is a brief summary of changes made in each release of Libint.
- 2019-xx-yy: 2.7.0-beta.3
- added 2018 CODATA bohr->angstrom conversion, made the default throughout
- Molden exporters use angstroms to avoid extra reliance on its readers' conversion
- resolves issue #158: check for false-positive Eigen search

- 2019-11-26: 2.7.0-beta.2
- resolves issue #143: definition of M_PI in c-api.c may be missing
Expand Down
38 changes: 31 additions & 7 deletions export/cmake/CMakeLists.txt.export
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,38 @@ if (ENABLE_MPFR)
endif()
endif()

find_package(Eigen3)
if (EIGEN3_FOUND)
add_library(Eigen INTERFACE)
# look for Eigen
# prefer CMake-configured-and-installed instance
# 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 NO_MODULE QUIET NO_CMAKE_PACKAGE_REGISTRY)
if (TARGET Eigen3::Eigen)
add_library(Eigen INTERFACE)
foreach(prop INTERFACE_INCLUDE_DIRECTORIES INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_OPTIONS INTERFACE_LINK_LIBRARIES INTERFACE_POSITION_INDEPENDENT_CODE)
get_property(EIGEN3_${prop} TARGET Eigen3::Eigen PROPERTY ${prop})
set_property(TARGET Eigen PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${EIGEN3_INCLUDE_DIR})
install(TARGETS Eigen EXPORT libint2 COMPONENT Eigen)
set(LIBINT_HAS_EIGEN 1)
endif (EIGEN3_FOUND)
${prop} ${EIGEN3_${prop}})
endforeach()
else (TARGET Eigen3::Eigen)
# otherwise use FindEigen3.cmake module possibly installed somewhere in the path
# but make sure EIGEN3_INCLUDE_DIR exists!
find_package(Eigen3)
if (EIGEN3_FOUND)
if (NOT EXISTS "${EIGEN3_INCLUDE_DIR}")
message(WARNING "Eigen3 is \"found\", but the reported EIGEN3_INCLUDE_DIR=${EIGEN3_INCLUDE_DIR} does not exist; likely corrupt Eigen3 build registered in user or system package registry; specify EIGEN3_INCLUDE_DIR manually or (better) configure (with CMake) and install Eigen3 package")
else(NOT EXISTS "${EIGEN3_INCLUDE_DIR}")
add_library(Eigen INTERFACE)
set_property(TARGET Eigen PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${EIGEN3_INCLUDE_DIR})
endif(NOT EXISTS "${EIGEN3_INCLUDE_DIR}")
endif (EIGEN3_FOUND)
endif (TARGET Eigen3::Eigen)
if (TARGET Eigen)
get_property(EIGEN3_INCLUDE_DIR TARGET Eigen PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "Found Eigen3: EIGEN3_INCLUDE_DIR=${EIGEN3_INCLUDE_DIR}")
install(TARGETS Eigen EXPORT libint2 COMPONENT Eigen)
set(LIBINT_HAS_EIGEN 1)
endif(TARGET Eigen)

find_package(Boost 1.29)
if (Boost_FOUND)
Expand Down

0 comments on commit 969cc73

Please sign in to comment.