FindGLEW.cmake 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # - Find GLEW library
  2. # Find the native Glew includes and library
  3. # This module defines
  4. # GLEW_INCLUDE_DIRS, where to find glew.h, Set when
  5. # GLEW_INCLUDE_DIR is found.
  6. # GLEW_ROOT_DIR, The base directory to search for Glew.
  7. # This can also be an environment variable.
  8. # GLEW_FOUND, If false, do not try to use Glew.
  9. #
  10. # also defined,
  11. # GLEW_LIBRARY, where to find the Glew library.
  12. # GLEW_MX_LIBRARY, where to find the GlewMX library.
  13. #=============================================================================
  14. # Copyright 2014 Blender Foundation.
  15. #
  16. # Distributed under the OSI-approved BSD License (the "License");
  17. # see accompanying file Copyright.txt for details.
  18. #
  19. # This software is distributed WITHOUT ANY WARRANTY; without even the
  20. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  21. # See the License for more information.
  22. #=============================================================================
  23. # If GLEW_ROOT_DIR was defined in the environment, use it.
  24. IF(NOT GLEW_ROOT_DIR AND NOT $ENV{GLEW_ROOT_DIR} STREQUAL "")
  25. SET(GLEW_ROOT_DIR $ENV{GLEW_ROOT_DIR})
  26. ENDIF()
  27. SET(_glew_SEARCH_DIRS
  28. ${GLEW_ROOT_DIR}
  29. /usr/local
  30. )
  31. FIND_PATH(GLEW_INCLUDE_DIR
  32. NAMES
  33. GL/glew.h
  34. HINTS
  35. ${_glew_SEARCH_DIRS}
  36. PATH_SUFFIXES
  37. include
  38. )
  39. FIND_LIBRARY(GLEW_LIBRARY
  40. NAMES
  41. GLEW
  42. HINTS
  43. ${_glew_SEARCH_DIRS}
  44. PATH_SUFFIXES
  45. lib64 lib
  46. )
  47. FIND_LIBRARY(GLEW_MX_LIBRARY
  48. NAMES
  49. GLEWmx
  50. HINTS
  51. ${_glew_SEARCH_DIRS}
  52. PATH_SUFFIXES
  53. lib64 lib
  54. )
  55. # handle the QUIETLY and REQUIRED arguments and set GLEW_FOUND to TRUE if
  56. # all listed variables are TRUE
  57. INCLUDE(FindPackageHandleStandardArgs)
  58. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Glew DEFAULT_MSG
  59. GLEW_LIBRARY GLEW_INCLUDE_DIR)
  60. IF(GLEW_FOUND)
  61. SET(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR})
  62. ENDIF(GLEW_FOUND)
  63. MARK_AS_ADVANCED(
  64. GLEW_INCLUDE_DIR
  65. GLEW_LIBRARY
  66. GLEW_MX_LIBRARY
  67. )
  68. UNSET(_glew_SEARCH_DIRS)