FindEigen3.cmake 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. )
  30. FIND_PATH(EIGEN3_INCLUDE_DIR
  31. NAMES
  32. # header has no '.h' suffix
  33. Eigen/Eigen
  34. HINTS
  35. ${_eigen3_SEARCH_DIRS}
  36. PATH_SUFFIXES
  37. include/eigen3
  38. )
  39. # handle the QUIETLY and REQUIRED arguments and set EIGEN3_FOUND to TRUE if
  40. # all listed variables are TRUE
  41. INCLUDE(FindPackageHandleStandardArgs)
  42. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Eigen3 DEFAULT_MSG
  43. EIGEN3_INCLUDE_DIR)
  44. IF(EIGEN3_FOUND)
  45. SET(EIGEN3_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
  46. ENDIF(EIGEN3_FOUND)
  47. MARK_AS_ADVANCED(
  48. EIGEN3_INCLUDE_DIR
  49. )