diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-03-19 07:41:41 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-03-19 07:41:41 +0300 |
commit | 4b88541d59302d4e65ecc66093a367091538c32d (patch) | |
tree | 57f6228286aa61a324f65d0ab7ad1cbd4d4cbef2 /build_files/cmake/Modules/FindEigen3.cmake | |
parent | 2df4444deff15d7e1cb150a201e0ffc9b44d9fd1 (diff) |
CMake: unbundle eigen3
Optionally use systems eigen3 library.
T41989 by @hasufell with edits
Diffstat (limited to 'build_files/cmake/Modules/FindEigen3.cmake')
-rw-r--r-- | build_files/cmake/Modules/FindEigen3.cmake | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/build_files/cmake/Modules/FindEigen3.cmake b/build_files/cmake/Modules/FindEigen3.cmake new file mode 100644 index 00000000000..400e8eb047d --- /dev/null +++ b/build_files/cmake/Modules/FindEigen3.cmake @@ -0,0 +1,56 @@ +# - Find Eigen3 library +# Find the native Eigen3 includes and library +# This module defines +# EIGEN3_INCLUDE_DIRS, where to find spnav.h, Set when +# EIGEN3_INCLUDE_DIR is found. +# EIGEN3_ROOT_DIR, The base directory to search for Eigen3. +# This can also be an environment variable. +# EIGEN3_FOUND, If false, do not try to use Eigen3. +# +#============================================================================= +# Copyright 2015 Blender Foundation. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +# If EIGEN3_ROOT_DIR was defined in the environment, use it. +IF(NOT EIGEN3_ROOT_DIR AND NOT $ENV{EIGEN3_ROOT_DIR} STREQUAL "") + SET(EIGEN3_ROOT_DIR $ENV{EIGEN3_ROOT_DIR}) +ENDIF() + +SET(_eigen3_SEARCH_DIRS + ${EIGEN3_ROOT_DIR} + /usr/local + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave +) + +FIND_PATH(EIGEN3_INCLUDE_DIR + NAMES + # header has no '.h' suffix + Eigen/Eigen + HINTS + ${_eigen3_SEARCH_DIRS} + PATH_SUFFIXES + include/eigen3 +) + +# handle the QUIETLY and REQUIRED arguments and set EIGEN3_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Eigen3 DEFAULT_MSG + EIGEN3_INCLUDE_DIR) + +IF(EIGEN3_FOUND) + SET(EIGEN3_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR}) +ENDIF(EIGEN3_FOUND) + +MARK_AS_ADVANCED( + EIGEN3_INCLUDE_DIR +) |