From 82c217d0e392d4ebf1843828e8cc48eca9ea2e72 Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Tue, 25 Jun 2013 14:15:49 +0200 Subject: [PATCH 1/5] Require the newer 3.1 version of Eigen --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8cb01aab5..b03c3aa53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set (${project}_DEPS dune-istl REQUIRED; opm-core REQUIRED" # Eigen - "Eigen3 REQUIRED" + "Eigen3 3.1 REQUIRED" ) # Additional search modules From b446ac99e2cedb5ea4bb4583fc75be463312a874 Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Tue, 25 Jun 2013 14:30:24 +0200 Subject: [PATCH 2/5] Allow user to specify path to Eigen3 library By setting EIGEN3_ROOT, we can point directly to the path of the library checkout we want to use. No other searching will then take place. Notice that if you have found an Eigen3 installation in a previous configure, it will not find a new version even if you introduce the EIGEN3_ROOT variable! --- cmake/Modules/FindEigen3.cmake | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cmake/Modules/FindEigen3.cmake b/cmake/Modules/FindEigen3.cmake index 9c546a05d..a53868487 100644 --- a/cmake/Modules/FindEigen3.cmake +++ b/cmake/Modules/FindEigen3.cmake @@ -61,12 +61,23 @@ if (EIGEN3_INCLUDE_DIR) else (EIGEN3_INCLUDE_DIR) - find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library + # if the _ROOT is specified, then look *only* there; don't allow any + # other version to be swapped in to substitute; if not specified, then + # go search usual locations + if (EIGEN3_ROOT) + find_path (EIGEN3_INCLUDE_DIR + NAMES signature_of_eigen3_matrix_library + PATHS ${EIGEN3_ROOT} + NO_DEFAULT_PATH + ) + else (EIGEN3_ROOT) + find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library PATHS ${CMAKE_INSTALL_PREFIX}/include ${KDE4_INCLUDE_DIR} PATH_SUFFIXES eigen3 eigen ) + endif (EIGEN3_ROOT) if(EIGEN3_INCLUDE_DIR) _eigen3_check_version() From 05e516bb4a35a15fac608c2148e8672c1931c89a Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Tue, 25 Jun 2013 14:35:23 +0200 Subject: [PATCH 3/5] Allow mixed case name in variable (as for package) Since the package is named Eigen3 (in mixed case), we should allow for the variable to be named this way, too. --- cmake/Modules/FindEigen3.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/Modules/FindEigen3.cmake b/cmake/Modules/FindEigen3.cmake index a53868487..43964344c 100644 --- a/cmake/Modules/FindEigen3.cmake +++ b/cmake/Modules/FindEigen3.cmake @@ -61,6 +61,11 @@ if (EIGEN3_INCLUDE_DIR) else (EIGEN3_INCLUDE_DIR) + # allow Eigen3_ROOT to be used in addition to EIGEN3_ROOT + if (Eigen3_ROOT) + set (EIGEN3_ROOT "${Eigen3_ROOT}") + endif (Eigen3_ROOT) + # if the _ROOT is specified, then look *only* there; don't allow any # other version to be swapped in to substitute; if not specified, then # go search usual locations From eef87e48ad774bff1661c794caa97457bc08dd15 Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Tue, 25 Jun 2013 14:45:35 +0200 Subject: [PATCH 4/5] Use standard code to handle not found case Instead of setting EIGEN3_FOUND ourselves, rely on the standard method to check arguments and raise an error if not found. --- cmake/Modules/FindEigen3.cmake | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/cmake/Modules/FindEigen3.cmake b/cmake/Modules/FindEigen3.cmake index 43964344c..5169e6157 100644 --- a/cmake/Modules/FindEigen3.cmake +++ b/cmake/Modules/FindEigen3.cmake @@ -53,13 +53,8 @@ macro(_eigen3_check_version) endif(NOT EIGEN3_VERSION_OK) endmacro(_eigen3_check_version) -if (EIGEN3_INCLUDE_DIR) - - # in cache already - _eigen3_check_version() - set(EIGEN3_FOUND ${EIGEN3_VERSION_OK}) - -else (EIGEN3_INCLUDE_DIR) +# only probe if we haven't a path in our cache +if (NOT EIGEN3_INCLUDE_DIR) # allow Eigen3_ROOT to be used in addition to EIGEN3_ROOT if (Eigen3_ROOT) @@ -83,6 +78,7 @@ else (EIGEN3_INCLUDE_DIR) PATH_SUFFIXES eigen3 eigen ) endif (EIGEN3_ROOT) +endif (NOT EIGEN3_INCLUDE_DIR) if(EIGEN3_INCLUDE_DIR) _eigen3_check_version() @@ -93,5 +89,4 @@ else (EIGEN3_INCLUDE_DIR) mark_as_advanced(EIGEN3_INCLUDE_DIR) -endif(EIGEN3_INCLUDE_DIR) From 6b9d1e2da57ac6ffcbf4c027ef7b4f01566b7d9c Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Tue, 25 Jun 2013 14:54:22 +0200 Subject: [PATCH 5/5] Search common suffixes for include files This allows us to set e.g. -DEIGEN3_ROOT=/usr/local, and have the files actually be located in /usr/local/include/eigen3 --- cmake/Modules/FindEigen3.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/Modules/FindEigen3.cmake b/cmake/Modules/FindEigen3.cmake index 5169e6157..014b59076 100644 --- a/cmake/Modules/FindEigen3.cmake +++ b/cmake/Modules/FindEigen3.cmake @@ -68,6 +68,7 @@ if (NOT EIGEN3_INCLUDE_DIR) find_path (EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library PATHS ${EIGEN3_ROOT} + PATH_SUFFIXES eigen3 include/eigen3 eigen include/eigen NO_DEFAULT_PATH ) else (EIGEN3_ROOT)