12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #
  2. # Find GLM
  3. #
  4. # Try to find GLM : OpenGL Mathematics.
  5. # This module defines
  6. # - GLM_INCLUDE_DIRS
  7. # - GLM_FOUND
  8. #
  9. # The following variables can be set as arguments for the module.
  10. # - GLM_ROOT_DIR : Root library directory of GLM
  11. #
  12. # References:
  13. # - https://github.com/Groovounet/glm/blob/master/util/FindGLM.cmake
  14. # - https://bitbucket.org/alfonse/gltut/src/28636298c1c0/glm-0.9.0.7/FindGLM.cmake
  15. #
  16. # Additional modules
  17. include(FindPackageHandleStandardArgs)
  18. if (WIN32)
  19. # Find include files
  20. find_path(
  21. GLM_INCLUDE_DIR
  22. NAMES glm/glm.hpp
  23. PATHS
  24. $ENV{PROGRAMFILES}/include
  25. ${GLM_ROOT_DIR}/include
  26. DOC "The directory where glm/glm.hpp resides")
  27. else()
  28. # Find include files
  29. find_path(
  30. GLM_INCLUDE_DIR
  31. NAMES glm/glm.hpp
  32. PATHS
  33. /usr/include
  34. /usr/local/include
  35. /sw/include
  36. /opt/local/include
  37. ${GLM_ROOT_DIR}/include
  38. DOC "The directory where glm/glm.hpp resides")
  39. endif()
  40. # Handle REQUIRD argument, define *_FOUND variable
  41. find_package_handle_standard_args(GLM DEFAULT_MSG GLM_INCLUDE_DIR)
  42. # Define GLM_INCLUDE_DIRS
  43. if (GLM_FOUND)
  44. set(GLM_INCLUDE_DIRS ${GLM_INCLUDE_DIR})
  45. endif()
  46. # Hide some variables
  47. mark_as_advanced(GLM_INCLUDE_DIR)