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")
48 # Handle HP-UX cases where we only want to find OpenGL in either hpux64
49 # or hpux32 depending on if we're doing a 64 bit build.
50 IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
51 SET(HPUX_IA_OPENGL_LIB_PATH /opt/graphics/OpenGL/lib/hpux32/)
52 ELSE(CMAKE_SIZEOF_VOID_P EQUAL 4)
53 SET(HPUX_IA_OPENGL_LIB_PATH
54 /opt/graphics/OpenGL/lib/hpux64/
55 /opt/graphics/OpenGL/lib/pa20_64)
56 ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
58 # The first line below is to make sure that the proper headers
59 # are used on a Linux machine with the NVidia drivers installed.
60 # They replace Mesa with NVidia's own library but normally do not
61 # install headers and that causes the linking to
62 # fail since the compiler finds the Mesa headers but NVidia's library.
63 # Make sure the NVIDIA directory comes BEFORE the others.
64 # - Atanas Georgiev <atanas@cs.columbia.edu>
66 FIND_PATH(OPENGL_INCLUDE_DIR GL/gl.h
67 /usr/share/doc/NVIDIA_GLX-1.0/include
68 /usr/openwin/share/include
69 /opt/graphics/OpenGL/include /usr/X11R6/include
72 FIND_PATH(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h
73 /usr/share/doc/NVIDIA_GLX-1.0/include
74 /usr/openwin/share/include
75 /opt/graphics/OpenGL/include /usr/X11R6/include
78 FIND_LIBRARY(OPENGL_gl_LIBRARY
80 PATHS /opt/graphics/OpenGL/lib
82 /usr/shlib /usr/X11R6/lib
83 ${HPUX_IA_OPENGL_LIB_PATH}
86 # On Unix OpenGL most certainly always requires X11.
87 # Feel free to tighten up these conditions if you don't
88 # think this is always true.
89 # It's not true on OSX.
91 IF (OPENGL_gl_LIBRARY)
97 SET (OPENGL_LIBRARIES ${X11_LIBRARIES})
100 ENDIF (OPENGL_gl_LIBRARY)
102 FIND_LIBRARY(OPENGL_glu_LIBRARY
104 PATHS ${OPENGL_gl_LIBRARY}
105 /opt/graphics/OpenGL/lib
107 /usr/shlib /usr/X11R6/lib
113 SET( OPENGL_FOUND "NO" )
114 IF(OPENGL_gl_LIBRARY)
116 IF(OPENGL_xmesa_INCLUDE_DIR)
117 SET( OPENGL_XMESA_FOUND "YES" )
118 ELSE(OPENGL_xmesa_INCLUDE_DIR)
119 SET( OPENGL_XMESA_FOUND "NO" )
120 ENDIF(OPENGL_xmesa_INCLUDE_DIR)
122 SET( OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_LIBRARIES})
123 IF(OPENGL_glu_LIBRARY)
124 SET( OPENGL_GLU_FOUND "YES" )
125 SET( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} )
126 ELSE(OPENGL_glu_LIBRARY)
127 SET( OPENGL_GLU_FOUND "NO" )
128 ENDIF(OPENGL_glu_LIBRARY)
130 SET( OPENGL_FOUND "YES" )
132 # This deprecated setting is for backward compatibility with CMake1.4
134 SET (OPENGL_LIBRARY ${OPENGL_LIBRARIES})
136 ENDIF(OPENGL_gl_LIBRARY)
138 # This deprecated setting is for backward compatibility with CMake1.4
139 SET(OPENGL_INCLUDE_PATH ${OPENGL_INCLUDE_DIR})
143 OPENGL_xmesa_INCLUDE_DIR