FindGLUT.cmake 2.6 KB

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