aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--cmake/FindEigen2.cmake19
1 files changed, 12 insertions, 7 deletions
diff --git a/cmake/FindEigen2.cmake b/cmake/FindEigen2.cmake
index 74e183e24..0e86aaf29 100644
--- a/cmake/FindEigen2.cmake
+++ b/cmake/FindEigen2.cmake
@@ -1,4 +1,9 @@
# - Try to find Eigen2 lib
+#
+# This module supports requiring a minimum version, e.g. you can do
+# find_package(Eigen2 2.0.3)
+# to require version 2.0.3 to newer of Eigen2.
+#
# Once done this will define
#
# EIGEN2_FOUND - system has eigen lib with correct version
@@ -9,7 +14,7 @@
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
# Redistribution and use is allowed according to the terms of the BSD license.
-if(NOT EIGEN2_MIN_VERSION)
+if(NOT Eigen2_FIND_VERSION)
if(NOT Eigen2_FIND_VERSION_MAJOR)
set(Eigen2_FIND_VERSION_MAJOR 2)
endif(NOT Eigen2_FIND_VERSION_MAJOR)
@@ -20,8 +25,8 @@ if(NOT EIGEN2_MIN_VERSION)
set(Eigen2_FIND_VERSION_PATCH 0)
endif(NOT Eigen2_FIND_VERSION_PATCH)
- set(EIGEN2_MIN_VERSION "${Eigen2_FIND_VERSION_MAJOR}.${Eigen2_FIND_VERSION_MINOR}.${Eigen2_FIND_VERSION_PATCH}")
-endif(NOT EIGEN2_MIN_VERSION)
+ set(Eigen2_FIND_VERSION "${Eigen2_FIND_VERSION_MAJOR}.${Eigen2_FIND_VERSION_MINOR}.${Eigen2_FIND_VERSION_PATCH}")
+endif(NOT Eigen2_FIND_VERSION)
macro(_eigen2_check_version)
file(READ "${EIGEN2_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen2_version_header LIMIT 5000 OFFSET 1000)
@@ -34,16 +39,16 @@ macro(_eigen2_check_version)
set(EIGEN2_MINOR_VERSION "${CMAKE_MATCH_1}")
set(EIGEN2_VERSION ${EIGEN2_WORLD_VERSION}.${EIGEN2_MAJOR_VERSION}.${EIGEN2_MINOR_VERSION})
- if(${EIGEN2_VERSION} VERSION_LESS ${EIGEN2_MIN_VERSION})
+ if(${EIGEN2_VERSION} VERSION_LESS ${Eigen2_FIND_VERSION})
set(EIGEN2_VERSION_OK FALSE)
- else(${EIGEN2_VERSION} VERSION_LESS ${EIGEN2_MIN_VERSION})
+ else(${EIGEN2_VERSION} VERSION_LESS ${Eigen2_FIND_VERSION})
set(EIGEN2_VERSION_OK TRUE)
- endif(${EIGEN2_VERSION} VERSION_LESS ${EIGEN2_MIN_VERSION})
+ endif(${EIGEN2_VERSION} VERSION_LESS ${Eigen2_FIND_VERSION})
if(NOT EIGEN2_VERSION_OK)
message(STATUS "Eigen2 version ${EIGEN2_VERSION} found in ${EIGEN2_INCLUDE_DIR}, "
- "but at least version ${EIGEN2_MIN_VERSION} is required")
+ "but at least version ${Eigen2_FIND_VERSION} is required")
endif(NOT EIGEN2_VERSION_OK)
endmacro(_eigen2_check_version)