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
11 # Also defined, but not for general use are
12 # OPENGL_gl_LIBRARY - Path to OpenGL Library
13 # OPENGL_glu_LIBRARY - Path to GLU Library
16 # On OSX default to using the framework version of opengl
17 # People will have to change the cache values of OPENGL_glu_LIBRARY
18 # and OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX
20 SET (OPENGL_gl_LIBRARY "-framework OpenGL" CACHE STRING "OpenGL lib for OSX")
21 SET (OPENGL_glu_LIBRARY "-framework AGL" CACHE STRING "AGL lib for OSX")
27 FIND_PATH(OPENGL_INCLUDE_DIR GL/gl.h
33 FIND_LIBRARY(OPENGL_gl_LIBRARY opengl32
38 FIND_LIBRARY(OPENGL_glu_LIBRARY glu32
46 SET (OPENGL_gl_LIBRARY import32 CACHE STRING "OpenGL library for win32")
47 SET (OPENGL_glu_LIBRARY import32 CACHE STRING "GLU library for win32")
49 SET (OPENGL_gl_LIBRARY opengl32 CACHE STRING "OpenGL library for win32")
50 SET (OPENGL_glu_LIBRARY glu32 CACHE STRING "GLU library for win32")
57 # The first line below is to make sure that the proper headers
58 # are used on a Linux machine with the NVidia drivers installed.
59 # They replace Mesa with NVidia's own library but normally do not
60 # install headers and that causes the linking to
61 # fail since the compiler finds the Mesa headers but NVidia's library.
62 # Make sure the NVIDIA directory comes BEFORE the others.
63 # - Atanas Georgiev <atanas@cs.columbia.edu>
65 FIND_PATH(OPENGL_INCLUDE_DIR GL/gl.h
66 /usr/share/doc/NVIDIA_GLX-1.0/include
69 /usr/openwin/share/include
70 /opt/graphics/OpenGL/include
74 FIND_PATH(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h
75 /usr/share/doc/NVIDIA_GLX-1.0/include
78 /usr/openwin/share/include
79 /opt/graphics/OpenGL/include
83 FIND_LIBRARY(OPENGL_gl_LIBRARY
87 /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.
96 IF (OPENGL_gl_LIBRARY)
97 INCLUDE( ${CMAKE_ROOT}/Modules/FindX11.cmake )
99 SET (OPENGL_LIBRARIES ${X11_LIBRARIES})
101 ENDIF (OPENGL_gl_LIBRARY)
103 FIND_LIBRARY(OPENGL_glu_LIBRARY
105 PATHS ${OPENGL_gl_LIBRARY}
108 /opt/graphics/OpenGL/lib
115 SET( OPENGL_FOUND "NO" )
116 IF(OPENGL_gl_LIBRARY)
118 IF(OPENGL_xmesa_INCLUDE_DIR)
119 SET( OPENGL_XMESA_FOUND "YES" )
120 ELSE(OPENGL_xmesa_INCLUDE_DIR)
121 SET( OPENGL_XMESA_FOUND "NO" )
122 ENDIF(OPENGL_xmesa_INCLUDE_DIR)
124 SET( OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_LIBRARIES})
125 IF(OPENGL_glu_LIBRARY)
126 SET( OPENGL_GLU_FOUND "YES" )
127 SET( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} )
128 ELSE(OPENGL_glu_LIBRARY)
129 SET( OPENGL_GLU_FOUND "NO" )
130 ENDIF(OPENGL_glu_LIBRARY)
132 SET( OPENGL_FOUND "YES" )
134 # This deprecated setting is for backward compatibility with CMake1.4
136 SET (OPENGL_LIBRARY ${OPENGL_LIBRARIES})
138 ENDIF(OPENGL_gl_LIBRARY)
140 # This deprecated setting is for backward compatibility with CMake1.4
141 SET(OPENGL_INCLUDE_PATH ${OPENGL_INCLUDE_DIR})
145 OPENGL_xmesa_INCLUDE_DIR