FindGLUT.cmake 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. # - try to find glut library and include files
  2. # GLUT_INCLUDE_DIR, where to find GL/glut.h, etc.
  3. # GLUT_LIBRARIES, the libraries to link against
  4. # GLUT_FOUND, If false, do not try to use GLUT.
  5. # Also defined, but not for general use are:
  6. # GLUT_glut_LIBRARY = the full path to the glut library.
  7. # GLUT_Xmu_LIBRARY = the full path to the Xmu library.
  8. # GLUT_Xi_LIBRARY = the full path to the Xi Library.
  9. IF (WIN32)
  10. IF(CYGWIN)
  11. FIND_PATH( GLUT_INCLUDE_DIR GL/glut.h )
  12. FIND_LIBRARY( GLUT_glut_LIBRARY glut32
  13. ${OPENGL_LIBRARY_DIR}
  14. )
  15. ELSE(CYGWIN)
  16. FIND_PATH( GLUT_INCLUDE_DIR GL/glut.h
  17. ${GLUT_ROOT_PATH}/include
  18. )
  19. FIND_LIBRARY( GLUT_glut_LIBRARY glut
  20. ${GLUT_ROOT_PATH}/Release
  21. ${OPENGL_LIBRARY_DIR}
  22. )
  23. ENDIF(CYGWIN)
  24. ELSE (WIN32)
  25. IF (APPLE)
  26. # These values for Apple could probably do with improvement.
  27. FIND_PATH( GLUT_INCLUDE_DIR glut.h
  28. /System/Library/Frameworks/GLUT.framework/Versions/A/Headers
  29. ${OPENGL_LIBRARY_DIR}
  30. )
  31. SET(GLUT_glut_LIBRARY "-framework GLUT" CACHE STRING "GLUT library for OSX")
  32. SET(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX")
  33. ELSE (APPLE)
  34. FIND_PATH( GLUT_INCLUDE_DIR GL/glut.h
  35. /usr/include/GL
  36. /usr/openwin/share/include
  37. /usr/openwin/include
  38. /opt/graphics/OpenGL/include
  39. /opt/graphics/OpenGL/contrib/libglut
  40. )
  41. FIND_LIBRARY( GLUT_glut_LIBRARY glut
  42. /usr/openwin/lib
  43. )
  44. FIND_LIBRARY( GLUT_Xi_LIBRARY Xi
  45. /usr/openwin/lib
  46. )
  47. FIND_LIBRARY( GLUT_Xmu_LIBRARY Xmu
  48. /usr/openwin/lib
  49. )
  50. ENDIF (APPLE)
  51. ENDIF (WIN32)
  52. SET( GLUT_FOUND "NO" )
  53. IF(GLUT_INCLUDE_DIR)
  54. IF(GLUT_glut_LIBRARY)
  55. # Is -lXi and -lXmu required on all platforms that have it?
  56. # If not, we need some way to figure out what platform we are on.
  57. SET( GLUT_LIBRARIES
  58. ${GLUT_glut_LIBRARY}
  59. ${GLUT_Xmu_LIBRARY}
  60. ${GLUT_Xi_LIBRARY}
  61. ${GLUT_cocoa_LIBRARY}
  62. )
  63. SET( GLUT_FOUND "YES" )
  64. #The following deprecated settings are for backwards compatibility with CMake1.4
  65. SET (GLUT_LIBRARY ${GLUT_LIBRARIES})
  66. SET (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR})
  67. ENDIF(GLUT_glut_LIBRARY)
  68. ENDIF(GLUT_INCLUDE_DIR)
  69. MARK_AS_ADVANCED(
  70. GLUT_INCLUDE_DIR
  71. GLUT_glut_LIBRARY
  72. GLUT_Xmu_LIBRARY
  73. GLUT_Xi_LIBRARY
  74. )