You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.9 KiB

  1. # Copyright (c) 2009 Boudewijn Rempt <boud@valdyas.org>
  2. #
  3. # Redistribution and use is allowed according to the terms of the BSD license.
  4. # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
  5. #
  6. # - try to find glew library and include files
  7. # GLEW_INCLUDE_DIR, where to find GL/glew.h, etc.
  8. # GLEW_LIBRARIES, the libraries to link against
  9. # GLEW_FOUND, If false, do not try to use GLEW.
  10. # Also defined, but not for general use are:
  11. # GLEW_GLEW_LIBRARY = the full path to the glew library.
  12. IF (WIN32)
  13. IF(CYGWIN)
  14. FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h)
  15. FIND_LIBRARY( GLEW_GLEW_LIBRARY glew32
  16. ${OPENGL_LIBRARY_DIR}
  17. /usr/lib/w32api
  18. /usr/X11R6/lib
  19. )
  20. ELSE(CYGWIN)
  21. FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h
  22. $ENV{GLEW_ROOT_PATH}/include
  23. )
  24. FIND_LIBRARY( GLEW_GLEW_LIBRARY
  25. NAMES glew glew32
  26. PATHS
  27. $ENV{GLEW_ROOT_PATH}/lib
  28. ${OPENGL_LIBRARY_DIR}
  29. )
  30. ENDIF(CYGWIN)
  31. ELSE (WIN32)
  32. IF (APPLE)
  33. # These values for Apple could probably do with improvement.
  34. FIND_PATH( GLEW_INCLUDE_DIR glew.h
  35. /System/Library/Frameworks/GLEW.framework/Versions/A/Headers
  36. ${OPENGL_LIBRARY_DIR}
  37. )
  38. SET(GLEW_GLEW_LIBRARY "-framework GLEW" CACHE STRING "GLEW library for OSX")
  39. SET(GLEW_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX")
  40. ELSE (APPLE)
  41. FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h
  42. /usr/include/GL
  43. /usr/openwin/share/include
  44. /usr/openwin/include
  45. /usr/X11R6/include
  46. /usr/include/X11
  47. /opt/graphics/OpenGL/include
  48. /opt/graphics/OpenGL/contrib/libglew
  49. )
  50. FIND_LIBRARY( GLEW_GLEW_LIBRARY GLEW
  51. /usr/openwin/lib
  52. /usr/X11R6/lib
  53. )
  54. ENDIF (APPLE)
  55. ENDIF (WIN32)
  56. SET( GLEW_FOUND "NO" )
  57. IF(GLEW_INCLUDE_DIR)
  58. IF(GLEW_GLEW_LIBRARY)
  59. # Is -lXi and -lXmu required on all platforms that have it?
  60. # If not, we need some way to figure out what platform we are on.
  61. SET( GLEW_LIBRARIES
  62. ${GLEW_GLEW_LIBRARY}
  63. ${GLEW_cocoa_LIBRARY}
  64. )
  65. SET( GLEW_FOUND "YES" )
  66. #The following deprecated settings are for backwards compatibility with CMake1.4
  67. SET (GLEW_LIBRARY ${GLEW_LIBRARIES})
  68. SET (GLEW_INCLUDE_PATH ${GLEW_INCLUDE_DIR})
  69. ENDIF(GLEW_GLEW_LIBRARY)
  70. ENDIF(GLEW_INCLUDE_DIR)
  71. IF(GLEW_FOUND)
  72. IF(NOT GLEW_FIND_QUIETLY)
  73. MESSAGE(STATUS "Found Glew: ${GLEW_LIBRARIES}")
  74. ENDIF(NOT GLEW_FIND_QUIETLY)
  75. ELSE(GLEW_FOUND)
  76. IF(GLEW_FIND_REQUIRED)
  77. MESSAGE(FATAL_ERROR "Could not find Glew")
  78. ENDIF(GLEW_FIND_REQUIRED)
  79. ENDIF(GLEW_FOUND)
  80. MARK_AS_ADVANCED(
  81. GLEW_INCLUDE_DIR
  82. GLEW_GLEW_LIBRARY
  83. GLEW_Xmu_LIBRARY
  84. GLEW_Xi_LIBRARY
  85. )