mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
If given build tree as Eigen3 root, find source
Eigen3 is a template-library, so we must compile the source code directly together with ours instead of linking to a library. If the build script gives us the location of a "built" Eigen3, meaning a directory in which CMake has been run, locate the true source directory from the cache entries.
This commit is contained in:
parent
ae7dcf690a
commit
3c678f06e4
@ -65,9 +65,36 @@ if (NOT EIGEN3_INCLUDE_DIR)
|
||||
# other version to be swapped in to substitute; if not specified, then
|
||||
# go search usual locations
|
||||
if (EIGEN3_ROOT)
|
||||
# if we are given the path to a "build" tree (meaning somewhere Eigen3
|
||||
# has been configured), then use the eigen3.pc file to figure out the
|
||||
# name of the *real* root directory
|
||||
if (EXISTS "${EIGEN3_ROOT}/CMakeCache.txt")
|
||||
# get the cache entry that tells use the source tree location
|
||||
set (_regex "Eigen_SOURCE_DIR:STATIC=\(.*\)")
|
||||
file (STRINGS
|
||||
"${EIGEN3_ROOT}/CMakeCache.txt"
|
||||
EIGEN3_SOURCE_TREE
|
||||
REGEX "${_regex}"
|
||||
)
|
||||
# trim away the key definition, be left with the value
|
||||
if (EIGEN3_SOURCE_TREE)
|
||||
string (REGEX REPLACE
|
||||
"${_regex}"
|
||||
"\\1"
|
||||
EIGEN3_SOURCE_TREE
|
||||
"${EIGEN3_SOURCE_TREE}"
|
||||
)
|
||||
# if something doesn't look as expected, abort and search in _ROOT
|
||||
else ()
|
||||
set (EIGEN3_SOURCE_TREE "${EIGEN3_ROOT}")
|
||||
endif ()
|
||||
else ()
|
||||
set (EIGEN3_SOURCE_TREE "${EIGEN3_ROOT}")
|
||||
endif ()
|
||||
|
||||
find_path (EIGEN3_INCLUDE_DIR
|
||||
NAMES signature_of_eigen3_matrix_library
|
||||
PATHS ${EIGEN3_ROOT}
|
||||
PATHS ${EIGEN3_SOURCE_TREE}
|
||||
PATH_SUFFIXES eigen3 include/eigen3 eigen include/eigen
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user