2 # Once done this will define
4 # OPENGL_FOUND - system has OpenGL and it should be used
5 # OPENGL_XMESA_FOUND - system has XMESA, and it should be used.
6 # OPENGL_GLU_FOUND - system has GLU and it should be used.
7 # OPENGL_INCLUDE_DIR - where the GL include directory can be found
8 # OPENGL_LIBRARIES - Link these to use OpenGL and GLU
10 # If you want to use just GL you can use these values
11 # OPENGL_gl_LIBRARY - Path to OpenGL Library
12 # OPENGL_glu_LIBRARY - Path to GLU Library
15 # On OSX default to using the framework version of opengl
16 # People will have to change the cache values of OPENGL_glu_LIBRARY
17 # and OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX
19 SET (OPENGL_gl_LIBRARY "-framework OpenGL" CACHE STRING "OpenGL lib for OSX")
20 SET (OPENGL_glu_LIBRARY "-framework AGL" CACHE STRING "AGL lib for OSX")
26 FIND_PATH(OPENGL_INCLUDE_DIR GL/gl.h
32 FIND_LIBRARY(OPENGL_gl_LIBRARY opengl32
37 FIND_LIBRARY(OPENGL_glu_LIBRARY glu32
45 SET (OPENGL_gl_LIBRARY import32 CACHE STRING "OpenGL library for win32")
46 SET (OPENGL_glu_LIBRARY import32 CACHE STRING "GLU library for win32")
48 SET (OPENGL_gl_LIBRARY opengl32 CACHE STRING "OpenGL library for win32")
49 SET (OPENGL_glu_LIBRARY glu32 CACHE STRING "GLU library for win32")
56 # The first line below is to make sure that the proper headers
57 # are used on a Linux machine with the NVidia drivers installed.
58 # They replace Mesa with NVidia's own library but normally do not
59 # install headers and that causes the linking to
60 # fail since the compiler finds the Mesa headers but NVidia's library.
61 # Make sure the NVIDIA directory comes BEFORE the others.
62 # - Atanas Georgiev <atanas@cs.columbia.edu>
64 FIND_PATH(OPENGL_INCLUDE_DIR GL/gl.h
65 /usr/share/doc/NVIDIA_GLX-1.0/include
68 /usr/openwin/share/include
69 /opt/graphics/OpenGL/include
73 FIND_PATH(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h
74 /usr/share/doc/NVIDIA_GLX-1.0/include
77 /usr/openwin/share/include
78 /opt/graphics/OpenGL/include
82 FIND_LIBRARY(OPENGL_gl_LIBRARY
86 /opt/graphics/OpenGL/lib
92 # On Unix OpenGL most certainly always requires X11.
93 # Feel free to tighten up these conditions if you don't
94 # think this is always true.
95 # It's not true on OSX.
97 IF (OPENGL_gl_LIBRARY)
101 SET (OPENGL_LIBRARIES ${X11_LIBRARIES})
104 ENDIF (OPENGL_gl_LIBRARY)
106 FIND_LIBRARY(OPENGL_glu_LIBRARY
108 PATHS ${OPENGL_gl_LIBRARY}
111 /opt/graphics/OpenGL/lib
119 SET( OPENGL_FOUND "NO" )
120 IF(OPENGL_gl_LIBRARY)
122 IF(OPENGL_xmesa_INCLUDE_DIR)
123 SET( OPENGL_XMESA_FOUND "YES" )
124 ELSE(OPENGL_xmesa_INCLUDE_DIR)
125 SET( OPENGL_XMESA_FOUND "NO" )
126 ENDIF(OPENGL_xmesa_INCLUDE_DIR)
128 SET( OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_LIBRARIES})
129 IF(OPENGL_glu_LIBRARY)
130 SET( OPENGL_GLU_FOUND "YES" )
131 SET( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} )
132 ELSE(OPENGL_glu_LIBRARY)
133 SET( OPENGL_GLU_FOUND "NO" )
134 ENDIF(OPENGL_glu_LIBRARY)
136 SET( OPENGL_FOUND "YES" )
138 # This deprecated setting is for backward compatibility with CMake1.4
140 SET (OPENGL_LIBRARY ${OPENGL_LIBRARIES})
142 ENDIF(OPENGL_gl_LIBRARY)
144 # This deprecated setting is for backward compatibility with CMake1.4
145 SET(OPENGL_INCLUDE_PATH ${OPENGL_INCLUDE_DIR})
149 OPENGL_xmesa_INCLUDE_DIR