FindGLM.cmake 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # FindGLM - attempts to locate the glm matrix/vector library.
  2. #
  3. # This module defines the following variables (on success):
  4. # GLM_INCLUDE_DIRS - where to find glm/glm.hpp
  5. # GLM_FOUND - if the library was successfully located
  6. #
  7. # It is trying a few standard installation locations, but can be customized
  8. # with the following variables:
  9. # GLM_ROOT_DIR - root directory of a glm installation
  10. # Headers are expected to be found in either:
  11. # <GLM_ROOT_DIR>/glm/glm.hpp OR
  12. # <GLM_ROOT_DIR>/include/glm/glm.hpp
  13. # This variable can either be a cmake or environment
  14. # variable. Note however that changing the value
  15. # of the environment varible will NOT result in
  16. # re-running the header search and therefore NOT
  17. # adjust the variables set by this module.
  18. #=============================================================================
  19. # Copyright 2012 Carsten Neumann
  20. #
  21. # Distributed under the OSI-approved BSD License (the "License");
  22. # see accompanying file Copyright.txt for details.
  23. #
  24. # This software is distributed WITHOUT ANY WARRANTY; without even the
  25. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  26. # See the License for more information.
  27. #=============================================================================
  28. # (To distribute this file outside of CMake, substitute the full
  29. # License text for the above reference.)
  30. # default search dirs
  31. SET(_glm_HEADER_SEARCH_DIRS
  32. "/usr/include"
  33. "/usr/local/include")
  34. # check environment variable
  35. SET(_glm_ENV_ROOT_DIR "$ENV{GLM_ROOT_DIR}")
  36. IF(NOT GLM_ROOT_DIR AND _glm_ENV_ROOT_DIR)
  37. SET(GLM_ROOT_DIR "${_glm_ENV_ROOT_DIR}")
  38. ENDIF(NOT GLM_ROOT_DIR AND _glm_ENV_ROOT_DIR)
  39. # put user specified location at beginning of search
  40. IF(GLM_ROOT_DIR)
  41. SET(_glm_HEADER_SEARCH_DIRS "${GLM_ROOT_DIR}"
  42. "${GLM_ROOT_DIR}/include"
  43. ${_glm_HEADER_SEARCH_DIRS})
  44. ENDIF(GLM_ROOT_DIR)
  45. # locate header
  46. FIND_PATH(GLM_INCLUDE_DIR "glm/glm.hpp"
  47. PATHS ${_glm_HEADER_SEARCH_DIRS})
  48. INCLUDE(FindPackageHandleStandardArgs)
  49. FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLM DEFAULT_MSG
  50. GLM_INCLUDE_DIR)
  51. IF(GLM_FOUND)
  52. SET(GLM_INCLUDE_DIRS "${GLM_INCLUDE_DIR}")
  53. MESSAGE(STATUS "GLM_INCLUDE_DIR = ${GLM_INCLUDE_DIR}")
  54. ENDIF(GLM_FOUND)