Skip to content

Commit

Permalink
Apply patch from Drew Parsons @debichem
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Hutchison <[email protected]>
  • Loading branch information
ghutchis committed Dec 19, 2023
1 parent 29b7fc3 commit 1d29053
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion avogadro/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ target_sources(Headers PUBLIC
utilities.h
vector.h
)
target_link_libraries(Headers INTERFACE Eigen3::Eigen3)
target_link_libraries(Headers INTERFACE Eigen3::Eigen)
install(TARGETS Headers
EXPORT "AvogadroLibsTargets"
FILE_SET HEADERS DESTINATION "${INSTALL_INCLUDE_DIR}")
Expand Down
22 changes: 11 additions & 11 deletions cmake/FindEigen3.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
find_path(Eigen3_INCLUDE_DIR
find_path(EIGEN3_INCLUDE_DIR
NAMES signature_of_eigen3_matrix_library
PATH_SUFFIXES eigen3 eigen
DOC "Eigen include directory")
mark_as_advanced(Eigen3_INCLUDE_DIR)
mark_as_advanced(EIGEN3_INCLUDE_DIR)

if (Eigen3_INCLUDE_DIR)
file(STRINGS "${Eigen3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _Eigen3_version_lines
if (EIGEN3_INCLUDE_DIR)
file(STRINGS "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _Eigen3_version_lines
REGEX "#define[ \t]+EIGEN_(WORLD|MAJOR|MINOR)_VERSION")
string(REGEX REPLACE ".*EIGEN_WORLD_VERSION *\([0-9]*\).*" "\\1" _Eigen3_version_world "${_Eigen3_version_lines}")
string(REGEX REPLACE ".*EIGEN_MAJOR_VERSION *\([0-9]*\).*" "\\1" _Eigen3_version_major "${_Eigen3_version_lines}")
Expand All @@ -19,15 +19,15 @@ endif ()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Eigen3
REQUIRED_VARS Eigen3_INCLUDE_DIR
VERSION_VAR Eigen3_VERSION)
REQUIRED_VARS EIGEN3_INCLUDE_DIR
VERSION_VAR EIGEN3_VERSION)

if (Eigen3_FOUND)
set(Eigen3_INCLUDE_DIRS "${Eigen3_INCLUDE_DIR}")
set(Eigen3_INCLUDE_DIRS "${EIGEN3_INCLUDE_DIR}")

if (NOT TARGET Eigen3::Eigen3)
add_library(Eigen3::Eigen3 INTERFACE IMPORTED)
set_target_properties(Eigen3::Eigen3 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Eigen3_INCLUDE_DIR}")
if (NOT TARGET Eigen3::Eigen)
add_library(Eigen3::Eigen INTERFACE IMPORTED)
set_target_properties(Eigen3::Eigen PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${EIGEN3_INCLUDE_DIR}")
endif ()
endif ()
5 changes: 3 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ include_directories("${AvogadroLibs_BINARY_DIR}/avogadro/core")

# find google test
find_package(GTest REQUIRED)
find_package(Eigen3 REQUIRED)
# Add both as "system headers" to avoid warnings generated by them with
# compilers that support that notion.
include_directories(SYSTEM
${GTEST_INCLUDE_DIRS})
${GTEST_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR})

include(CheckIncludeFileCXX)
include(CheckCXXSymbolExists)
Expand Down Expand Up @@ -42,4 +44,3 @@ if(USE_OPENGL)
add_subdirectory(qtopengl)
endif()
endif()

0 comments on commit 1d29053

Please sign in to comment.