ENH: add support for g77 extra _ at the end of functions that have an _ in the name...
[cmake.git] / Modules / FindGLUT.cmake
blobc838b01910cde08abbb68933544bea8af93c6b53
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.
10 IF (WIN32)
11   FIND_PATH( GLUT_INCLUDE_DIR NAMES GL/glut.h 
12     PATHS  ${GLUT_ROOT_PATH}/include )
13   FIND_LIBRARY( GLUT_glut_LIBRARY NAMES glut glut32
14     PATHS
15     ${OPENGL_LIBRARY_DIR}
16     ${GLUT_ROOT_PATH}/Release
17     )
18 ELSE (WIN32)
19   
20   IF (APPLE)
21     # These values for Apple could probably do with improvement.
22     FIND_PATH( GLUT_INCLUDE_DIR glut.h
23       /System/Library/Frameworks/GLUT.framework/Versions/A/Headers
24       ${OPENGL_LIBRARY_DIR}
25       )
26     SET(GLUT_glut_LIBRARY "-framework GLUT" CACHE STRING "GLUT library for OSX") 
27     SET(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX")
28   ELSE (APPLE)
29     
30     FIND_PATH( GLUT_INCLUDE_DIR GL/glut.h
31       /usr/include/GL
32       /usr/openwin/share/include
33       /usr/openwin/include
34       /opt/graphics/OpenGL/include
35       /opt/graphics/OpenGL/contrib/libglut
36       )
37   
38     FIND_LIBRARY( GLUT_glut_LIBRARY glut
39       /usr/openwin/lib
40       )
41     
42     FIND_LIBRARY( GLUT_Xi_LIBRARY Xi
43       /usr/openwin/lib
44       )
45     
46     FIND_LIBRARY( GLUT_Xmu_LIBRARY Xmu
47       /usr/openwin/lib
48       )
49     
50   ENDIF (APPLE)
51   
52 ENDIF (WIN32)
54 SET( GLUT_FOUND "NO" )
55 IF(GLUT_INCLUDE_DIR)
56   IF(GLUT_glut_LIBRARY)
57     # Is -lXi and -lXmu required on all platforms that have it?
58     # If not, we need some way to figure out what platform we are on.
59     SET( GLUT_LIBRARIES
60       ${GLUT_glut_LIBRARY}
61       ${GLUT_Xmu_LIBRARY}
62       ${GLUT_Xi_LIBRARY} 
63       ${GLUT_cocoa_LIBRARY}
64       )
65     SET( GLUT_FOUND "YES" )
66     
67     #The following deprecated settings are for backwards compatibility with CMake1.4
68     SET (GLUT_LIBRARY ${GLUT_LIBRARIES})
69     SET (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR})
70     
71   ENDIF(GLUT_glut_LIBRARY)
72 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   )