STYLE: Nightly Version update
[cmake.git] / Modules / FindGLUT.cmake
blob16d5f2750e020481447a8a7572ad3e3a0833ed3f
2 # try to find glut library and include files
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.
8 # also defined, but not for general use are
9 # GLUT_glut_LIBRARY = the full path to the glut library.
10 # GLUT_Xmu_LIBRARY  = the full path to the Xmu library if available.
11 # GLUT_Xi_LIBRARY   = the full path to the Xi Library if available.
13 IF (WIN32)
15   IF(CYGWIN)
17     FIND_PATH( GLUT_INCLUDE_DIR GL/glut.h
18       /usr/include
19     )
21     FIND_LIBRARY( GLUT_glut_LIBRARY glut32
22       ${OPENGL_LIBRARY_DIR}
23       /usr/lib
24       /usr/lib/w32api
25       /usr/local/lib
26       /usr/X11R6/lib
27     )
30   ELSE(CYGWIN)
32     FIND_PATH( GLUT_INCLUDE_DIR GL/glut.h
33       ${GLUT_ROOT_PATH}/include
34     )
36     FIND_LIBRARY( GLUT_glut_LIBRARY glut
37       ${GLUT_ROOT_PATH}/Release
38       ${OPENGL_LIBRARY_DIR}
39     )
41   ENDIF(CYGWIN)
43 ELSE (WIN32)
45   IF (APPLE)
46 # These values for Apple could probably do with improvement.
47     FIND_PATH( GLUT_INCLUDE_DIR GL/glut.h
48       ${OPENGL_LIBRARY_DIR}
49     )
50     SET(GLUT_glut_LIBRARY "-framework Glut" CACHE STRING "GLUT library for OSX") 
51     SET(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX")
52   ELSE (APPLE)
54     FIND_PATH( GLUT_INCLUDE_DIR GL/glut.h
55       /usr/include
56       /usr/include/GL
57       /usr/local/include
58       /usr/openwin/share/include
59       /usr/openwin/include
60       /usr/X11R6/include
61       /usr/include/X11
62       /opt/graphics/OpenGL/include
63       /opt/graphics/OpenGL/contrib/libglut
64     )
66     FIND_LIBRARY( GLUT_glut_LIBRARY glut
67       /usr/lib
68       /usr/local/lib
69       /usr/openwin/lib
70       /usr/X11R6/lib
71     )
73     FIND_LIBRARY( GLUT_Xi_LIBRARY Xi
74       /usr/lib
75       /usr/local/lib
76       /usr/openwin/lib
77       /usr/X11R6/lib
78     )
80     FIND_LIBRARY( GLUT_Xmu_LIBRARY Xmu
81       /usr/lib
82       /usr/local/lib
83       /usr/openwin/lib
84       /usr/X11R6/lib
85     )
87   ENDIF (APPLE)
89 ENDIF (WIN32)
91 SET( GLUT_FOUND "NO" )
92 IF(GLUT_INCLUDE_DIR)
93   IF(GLUT_glut_LIBRARY)
94     # Is -lXi and -lXmu required on all platforms that have it?
95     # If not, we need some way to figure out what platform we are on.
96     SET( GLUT_LIBRARIES
97       ${GLUT_glut_LIBRARY}
98       ${GLUT_Xmu_LIBRARY}
99       ${GLUT_Xi_LIBRARY} 
100       ${GLUT_cocoa_LIBRARY}
101     )
102     SET( GLUT_FOUND "YES" )
104 #The following deprecated settings are for backwards compatibility with CMake1.4
105     SET (GLUT_LIBRARY ${GLUT_LIBRARIES})
106     SET (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR})
108   ENDIF(GLUT_glut_LIBRARY)
109 ENDIF(GLUT_INCLUDE_DIR)
111 MARK_AS_ADVANCED(
112   GLUT_INCLUDE_DIR
113   GLUT_glut_LIBRARY
114   GLUT_Xmu_LIBRARY
115   GLUT_Xi_LIBRARY