FindGLUT.cmake 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. #=============================================================================
  10. # Copyright 2001-2009 Kitware, Inc.
  11. #
  12. # Distributed under the OSI-approved BSD License (the "License");
  13. # see accompanying file Copyright.txt for details.
  14. #
  15. # This software is distributed WITHOUT ANY WARRANTY; without even the
  16. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  17. # See the License for more information.
  18. #=============================================================================
  19. # (To distributed this file outside of CMake, substitute the full
  20. # License text for the above reference.)
  21. IF (WIN32)
  22. FIND_PATH( GLUT_INCLUDE_DIR NAMES GL/glut.h
  23. PATHS ${GLUT_ROOT_PATH}/include )
  24. FIND_LIBRARY( GLUT_glut_LIBRARY NAMES glut glut32
  25. PATHS
  26. ${OPENGL_LIBRARY_DIR}
  27. ${GLUT_ROOT_PATH}/Release
  28. )
  29. ELSE (WIN32)
  30. IF (APPLE)
  31. # These values for Apple could probably do with improvement.
  32. FIND_PATH( GLUT_INCLUDE_DIR glut.h
  33. /System/Library/Frameworks/GLUT.framework/Versions/A/Headers
  34. ${OPENGL_LIBRARY_DIR}
  35. )
  36. SET(GLUT_glut_LIBRARY "-framework GLUT" CACHE STRING "GLUT library for OSX")
  37. SET(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX")
  38. ELSE (APPLE)
  39. FIND_PATH( GLUT_INCLUDE_DIR GL/glut.h
  40. /usr/include/GL
  41. /usr/openwin/share/include
  42. /usr/openwin/include
  43. /opt/graphics/OpenGL/include
  44. /opt/graphics/OpenGL/contrib/libglut
  45. )
  46. FIND_LIBRARY( GLUT_glut_LIBRARY glut
  47. /usr/openwin/lib
  48. )
  49. FIND_LIBRARY( GLUT_Xi_LIBRARY Xi
  50. /usr/openwin/lib
  51. )
  52. FIND_LIBRARY( GLUT_Xmu_LIBRARY Xmu
  53. /usr/openwin/lib
  54. )
  55. ENDIF (APPLE)
  56. ENDIF (WIN32)
  57. SET( GLUT_FOUND "NO" )
  58. IF(GLUT_INCLUDE_DIR)
  59. IF(GLUT_glut_LIBRARY)
  60. # Is -lXi and -lXmu required on all platforms that have it?
  61. # If not, we need some way to figure out what platform we are on.
  62. SET( GLUT_LIBRARIES
  63. ${GLUT_glut_LIBRARY}
  64. ${GLUT_Xmu_LIBRARY}
  65. ${GLUT_Xi_LIBRARY}
  66. ${GLUT_cocoa_LIBRARY}
  67. )
  68. SET( GLUT_FOUND "YES" )
  69. #The following deprecated settings are for backwards compatibility with CMake1.4
  70. SET (GLUT_LIBRARY ${GLUT_LIBRARIES})
  71. SET (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR})
  72. ENDIF(GLUT_glut_LIBRARY)
  73. ENDIF(GLUT_INCLUDE_DIR)
  74. MARK_AS_ADVANCED(
  75. GLUT_INCLUDE_DIR
  76. GLUT_glut_LIBRARY
  77. GLUT_Xmu_LIBRARY
  78. GLUT_Xi_LIBRARY
  79. )