FindGLUT.cmake 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 distribute 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 freeglut
  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. INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  58. FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLUT REQUIRED_VARS GLUT_glut_LIBRARY GLUT_INCLUDE_DIR)
  59. IF (GLUT_FOUND)
  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. #The following deprecated settings are for backwards compatibility with CMake1.4
  69. SET (GLUT_LIBRARY ${GLUT_LIBRARIES})
  70. SET (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR})
  71. ENDIF(GLUT_FOUND)
  72. MARK_AS_ADVANCED(
  73. GLUT_INCLUDE_DIR
  74. GLUT_glut_LIBRARY
  75. GLUT_Xmu_LIBRARY
  76. GLUT_Xi_LIBRARY
  77. )