Back to home page

EIC code displayed by LXR

 
 

    


Warning, /jana2/src/python/externals/pybind11-2.10.3/tools/FindEigen3.cmake is written in an unsupported language. File is not indexed.

0001 # - Try to find Eigen3 lib
0002 #
0003 # This module supports requiring a minimum version, e.g. you can do
0004 #   find_package(Eigen3 3.1.2)
0005 # to require version 3.1.2 or newer of Eigen3.
0006 #
0007 # Once done this will define
0008 #
0009 #  EIGEN3_FOUND - system has eigen lib with correct version
0010 #  EIGEN3_INCLUDE_DIR - the eigen include directory
0011 #  EIGEN3_VERSION - eigen version
0012 
0013 # Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
0014 # Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
0015 # Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
0016 # Redistribution and use is allowed according to the terms of the 2-clause BSD license.
0017 
0018 if(NOT Eigen3_FIND_VERSION)
0019   if(NOT Eigen3_FIND_VERSION_MAJOR)
0020     set(Eigen3_FIND_VERSION_MAJOR 2)
0021   endif(NOT Eigen3_FIND_VERSION_MAJOR)
0022   if(NOT Eigen3_FIND_VERSION_MINOR)
0023     set(Eigen3_FIND_VERSION_MINOR 91)
0024   endif(NOT Eigen3_FIND_VERSION_MINOR)
0025   if(NOT Eigen3_FIND_VERSION_PATCH)
0026     set(Eigen3_FIND_VERSION_PATCH 0)
0027   endif(NOT Eigen3_FIND_VERSION_PATCH)
0028 
0029   set(Eigen3_FIND_VERSION
0030       "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
0031 endif(NOT Eigen3_FIND_VERSION)
0032 
0033 macro(_eigen3_check_version)
0034   file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
0035 
0036   string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match
0037                "${_eigen3_version_header}")
0038   set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
0039   string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match
0040                "${_eigen3_version_header}")
0041   set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
0042   string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match
0043                "${_eigen3_version_header}")
0044   set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
0045 
0046   set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
0047   if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
0048     set(EIGEN3_VERSION_OK FALSE)
0049   else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
0050     set(EIGEN3_VERSION_OK TRUE)
0051   endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
0052 
0053   if(NOT EIGEN3_VERSION_OK)
0054 
0055     message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
0056                    "but at least version ${Eigen3_FIND_VERSION} is required")
0057   endif(NOT EIGEN3_VERSION_OK)
0058 endmacro(_eigen3_check_version)
0059 
0060 if(EIGEN3_INCLUDE_DIR)
0061 
0062   # in cache already
0063   _eigen3_check_version()
0064   set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
0065 
0066 else(EIGEN3_INCLUDE_DIR)
0067   if(NOT DEFINED KDE4_INCLUDE_DIR)
0068     set(KDE4_INCLUDE_DIR "")
0069   endif()
0070 
0071   find_path(
0072     EIGEN3_INCLUDE_DIR
0073     NAMES signature_of_eigen3_matrix_library
0074     PATHS ${CMAKE_INSTALL_PREFIX}/include ${KDE4_INCLUDE_DIR}
0075     PATH_SUFFIXES eigen3 eigen)
0076 
0077   if(EIGEN3_INCLUDE_DIR)
0078     _eigen3_check_version()
0079   endif(EIGEN3_INCLUDE_DIR)
0080 
0081   include(FindPackageHandleStandardArgs)
0082   find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
0083 
0084   mark_as_advanced(EIGEN3_INCLUDE_DIR)
0085 
0086 endif(EIGEN3_INCLUDE_DIR)