2 # Once done this will define
4 # OPENGL_FOUND - system has OpenGL
5 # OPENGL_XMESA_FOUND - system has XMESA
6 # OPENGL_GLU_FOUND - system has GLU
7 # OPENGL_INCLUDE_DIR - the GL include directory
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
14 # On OSX default to using the framework version of opengl
15 # People will have to change the cache values of OPENGL_glu_LIBRARY
16 # and OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX
21 FIND_PATH(OPENGL_INCLUDE_DIR GL/gl.h )
23 FIND_LIBRARY(OPENGL_gl_LIBRARY opengl32 )
25 FIND_LIBRARY(OPENGL_glu_LIBRARY glu32 )
30 SET (OPENGL_gl_LIBRARY import32 CACHE STRING "OpenGL library for win32")
31 SET (OPENGL_glu_LIBRARY import32 CACHE STRING "GLU library for win32")
33 SET (OPENGL_gl_LIBRARY opengl32 CACHE STRING "OpenGL library for win32")
34 SET (OPENGL_glu_LIBRARY glu32 CACHE STRING "GLU library for win32")
43 FIND_LIBRARY(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL lib for OSX")
44 FIND_LIBRARY(OPENGL_glu_LIBRARY AGL DOC "AGL lib for OSX")
45 FIND_PATH(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OSX")
49 # The first line below is to make sure that the proper headers
50 # are used on a Linux machine with the NVidia drivers installed.
51 # They replace Mesa with NVidia's own library but normally do not
52 # install headers and that causes the linking to
53 # fail since the compiler finds the Mesa headers but NVidia's library.
54 # Make sure the NVIDIA directory comes BEFORE the others.
55 # - Atanas Georgiev <atanas@cs.columbia.edu>
57 FIND_PATH(OPENGL_INCLUDE_DIR GL/gl.h
58 /usr/share/doc/NVIDIA_GLX-1.0/include
59 /usr/openwin/share/include
60 /opt/graphics/OpenGL/include /usr/X11R6/include
63 FIND_PATH(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h
64 /usr/share/doc/NVIDIA_GLX-1.0/include
65 /usr/openwin/share/include
66 /opt/graphics/OpenGL/include /usr/X11R6/include
69 FIND_LIBRARY(OPENGL_gl_LIBRARY
71 PATHS /opt/graphics/OpenGL/lib
73 /usr/shlib /usr/X11R6/lib
76 # On Unix OpenGL most certainly always requires X11.
77 # Feel free to tighten up these conditions if you don't
78 # think this is always true.
79 # It's not true on OSX.
81 IF (OPENGL_gl_LIBRARY)
87 SET (OPENGL_LIBRARIES ${X11_LIBRARIES})
90 ENDIF (OPENGL_gl_LIBRARY)
92 FIND_LIBRARY(OPENGL_glu_LIBRARY
94 PATHS ${OPENGL_gl_LIBRARY}
95 /opt/graphics/OpenGL/lib
97 /usr/shlib /usr/X11R6/lib
103 SET( OPENGL_FOUND "NO" )
104 IF(OPENGL_gl_LIBRARY)
106 IF(OPENGL_xmesa_INCLUDE_DIR)
107 SET( OPENGL_XMESA_FOUND "YES" )
108 ELSE(OPENGL_xmesa_INCLUDE_DIR)
109 SET( OPENGL_XMESA_FOUND "NO" )
110 ENDIF(OPENGL_xmesa_INCLUDE_DIR)
112 SET( OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_LIBRARIES})
113 IF(OPENGL_glu_LIBRARY)
114 SET( OPENGL_GLU_FOUND "YES" )
115 SET( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} )
116 ELSE(OPENGL_glu_LIBRARY)
117 SET( OPENGL_GLU_FOUND "NO" )
118 ENDIF(OPENGL_glu_LIBRARY)
120 SET( OPENGL_FOUND "YES" )
122 # This deprecated setting is for backward compatibility with CMake1.4
124 SET (OPENGL_LIBRARY ${OPENGL_LIBRARIES})
126 ENDIF(OPENGL_gl_LIBRARY)
128 # This deprecated setting is for backward compatibility with CMake1.4
129 SET(OPENGL_INCLUDE_PATH ${OPENGL_INCLUDE_DIR})
133 OPENGL_xmesa_INCLUDE_DIR