Warning, /graphics/digikam/core/cmake/modules/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 # SPDX-FileCopyrightText: 2006-2007 by Montel Laurent, <montel@kde.org>
0014 # SPDX-FileCopyrightText: 2008-2009 by Gael Guennebaud, <g.gael@free.fr>
0015 # SPDX-FileCopyrightText: 2009      by Benoit Jacob <jacob.benoit.1@gmail.com>
0016 #
0017 # SPDX-License-Identifier: BSD-3-Clause
0018 #
0019 
0020 if(NOT Eigen3_FIND_VERSION)
0021   if(NOT Eigen3_FIND_VERSION_MAJOR)
0022     set(Eigen3_FIND_VERSION_MAJOR 2)
0023   endif(NOT Eigen3_FIND_VERSION_MAJOR)
0024   if(NOT Eigen3_FIND_VERSION_MINOR)
0025     set(Eigen3_FIND_VERSION_MINOR 91)
0026   endif(NOT Eigen3_FIND_VERSION_MINOR)
0027   if(NOT Eigen3_FIND_VERSION_PATCH)
0028     set(Eigen3_FIND_VERSION_PATCH 0)
0029   endif(NOT Eigen3_FIND_VERSION_PATCH)
0030 
0031   set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
0032 endif(NOT Eigen3_FIND_VERSION)
0033 
0034 macro(_eigen3_check_version)
0035   file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
0036 
0037   string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_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 "${_eigen3_version_header}")
0040   set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
0041   string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
0042   set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
0043 
0044   set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
0045   if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
0046     set(EIGEN3_VERSION_OK FALSE)
0047   else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
0048     set(EIGEN3_VERSION_OK TRUE)
0049   endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
0050 
0051   if(NOT EIGEN3_VERSION_OK)
0052 
0053     message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
0054                    "but at least version ${Eigen3_FIND_VERSION} is required")
0055   endif(NOT EIGEN3_VERSION_OK)
0056 endmacro(_eigen3_check_version)
0057 
0058 if (EIGEN3_INCLUDE_DIR)
0059 
0060   # in cache already
0061   _eigen3_check_version()
0062   set(Eigen3_FOUND ${EIGEN3_VERSION_OK})
0063 
0064 else (EIGEN3_INCLUDE_DIR)
0065 
0066   find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
0067       PATHS
0068       ${CMAKE_INSTALL_PREFIX}/include
0069       ${KDE4_INCLUDE_DIR}
0070       PATH_SUFFIXES eigen3 eigen
0071     )
0072 
0073   if(EIGEN3_INCLUDE_DIR)
0074     _eigen3_check_version()
0075   endif(EIGEN3_INCLUDE_DIR)
0076 
0077   include(FindPackageHandleStandardArgs)
0078   find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
0079 
0080   mark_as_advanced(EIGEN3_INCLUDE_DIR)
0081 
0082 endif(EIGEN3_INCLUDE_DIR)
0083