FindEigen3.cmake 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # - Find Eigen3 library
  2. # Find the native Eigen3 includes and library
  3. # This module defines
  4. # EIGEN3_INCLUDE_DIRS, where to find spnav.h, Set when
  5. # EIGEN3_INCLUDE_DIR is found.
  6. # EIGEN3_ROOT_DIR, The base directory to search for Eigen3.
  7. # This can also be an environment variable.
  8. # EIGEN3_FOUND, If false, do not try to use Eigen3.
  9. #
  10. #=============================================================================
  11. # Copyright 2015 Blender Foundation.
  12. #
  13. # Distributed under the OSI-approved BSD License (the "License");
  14. # see accompanying file Copyright.txt for details.
  15. #
  16. # This software is distributed WITHOUT ANY WARRANTY; without even the
  17. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  18. # See the License for more information.
  19. #=============================================================================
  20. # If EIGEN3_ROOT_DIR was defined in the environment, use it.
  21. IF(NOT EIGEN3_ROOT_DIR AND NOT $ENV{EIGEN3_ROOT_DIR} STREQUAL "")
  22. SET(EIGEN3_ROOT_DIR $ENV{EIGEN3_ROOT_DIR})
  23. ENDIF()
  24. SET(_eigen3_SEARCH_DIRS
  25. ${EIGEN3_ROOT_DIR}
  26. /usr/local
  27. /sw # Fink
  28. /opt/local # DarwinPorts
  29. /opt/csw # Blastwave
  30. )
  31. FIND_PATH(EIGEN3_INCLUDE_DIR
  32. NAMES
  33. # header has no '.h' suffix
  34. Eigen/Eigen
  35. HINTS
  36. ${_eigen3_SEARCH_DIRS}
  37. PATH_SUFFIXES
  38. include/eigen3
  39. )
  40. # handle the QUIETLY and REQUIRED arguments and set EIGEN3_FOUND to TRUE if
  41. # all listed variables are TRUE
  42. INCLUDE(FindPackageHandleStandardArgs)
  43. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Eigen3 DEFAULT_MSG
  44. EIGEN3_INCLUDE_DIR)
  45. IF(EIGEN3_FOUND)
  46. SET(EIGEN3_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
  47. ENDIF(EIGEN3_FOUND)
  48. MARK_AS_ADVANCED(
  49. EIGEN3_INCLUDE_DIR
  50. )