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
18 #=============================================================================
19 # Copyright 2001-2009 Kitware, Inc.
21 # Distributed under the OSI-approved BSD License (the "License");
22 # see accompanying file Copyright.txt for details.
24 # This software is distributed WITHOUT ANY WARRANTY; without even the
25 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
26 # See the License for more information.
27 #=============================================================================
28 # (To distribute this file outside of CMake, substitute the full
29 # License text for the above reference.)
34 find_path(OPENGL_INCLUDE_DIR GL/gl.h )
36 find_library(OPENGL_gl_LIBRARY opengl32 )
38 find_library(OPENGL_glu_LIBRARY glu32 )
43 set (OPENGL_gl_LIBRARY import32 CACHE STRING "OpenGL library for win32")
44 set (OPENGL_glu_LIBRARY import32 CACHE STRING "GLU library for win32")
46 set (OPENGL_gl_LIBRARY opengl32 CACHE STRING "OpenGL library for win32")
47 set (OPENGL_glu_LIBRARY glu32 CACHE STRING "GLU library for win32")
56 find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL lib for OSX")
57 find_library(OPENGL_glu_LIBRARY AGL DOC "AGL lib for OSX")
58 find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OSX")
61 # Handle HP-UX cases where we only want to find OpenGL in either hpux64
62 # or hpux32 depending on if we're doing a 64 bit build.
63 if(CMAKE_SIZEOF_VOID_P EQUAL 4)
64 set(HPUX_IA_OPENGL_LIB_PATH /opt/graphics/OpenGL/lib/hpux32/)
66 set(HPUX_IA_OPENGL_LIB_PATH
67 /opt/graphics/OpenGL/lib/hpux64/
68 /opt/graphics/OpenGL/lib/pa20_64)
71 # The first line below is to make sure that the proper headers
72 # are used on a Linux machine with the NVidia drivers installed.
73 # They replace Mesa with NVidia's own library but normally do not
74 # install headers and that causes the linking to
75 # fail since the compiler finds the Mesa headers but NVidia's library.
76 # Make sure the NVIDIA directory comes BEFORE the others.
77 # - Atanas Georgiev <atanas@cs.columbia.edu>
79 find_path(OPENGL_INCLUDE_DIR GL/gl.h
80 /usr/share/doc/NVIDIA_GLX-1.0/include
81 /usr/openwin/share/include
82 /opt/graphics/OpenGL/include /usr/X11R6/include
85 find_path(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h
86 /usr/share/doc/NVIDIA_GLX-1.0/include
87 /usr/openwin/share/include
88 /opt/graphics/OpenGL/include /usr/X11R6/include
91 find_library(OPENGL_gl_LIBRARY
93 PATHS /opt/graphics/OpenGL/lib
95 /usr/shlib /usr/X11R6/lib
96 ${HPUX_IA_OPENGL_LIB_PATH}
99 # On Unix OpenGL most certainly always requires X11.
100 # Feel free to tighten up these conditions if you don't
101 # think this is always true.
102 # It's not true on OSX.
104 if (OPENGL_gl_LIBRARY)
110 set (OPENGL_LIBRARIES ${X11_LIBRARIES})
115 find_library(OPENGL_glu_LIBRARY
117 PATHS ${OPENGL_gl_LIBRARY}
118 /opt/graphics/OpenGL/lib
120 /usr/shlib /usr/X11R6/lib
126 if(OPENGL_gl_LIBRARY)
128 if(OPENGL_xmesa_INCLUDE_DIR)
129 set( OPENGL_XMESA_FOUND "YES" )
131 set( OPENGL_XMESA_FOUND "NO" )
134 set( OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_LIBRARIES})
135 if(OPENGL_glu_LIBRARY)
136 set( OPENGL_GLU_FOUND "YES" )
137 set( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} )
139 set( OPENGL_GLU_FOUND "NO" )
142 # This deprecated setting is for backward compatibility with CMake1.4
143 set (OPENGL_LIBRARY ${OPENGL_LIBRARIES})
147 # This deprecated setting is for backward compatibility with CMake1.4
148 set(OPENGL_INCLUDE_PATH ${OPENGL_INCLUDE_DIR})
150 # handle the QUIETLY and REQUIRED arguments and set OPENGL_FOUND to TRUE if
151 # all listed variables are TRUE
152 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
153 FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGL DEFAULT_MSG OPENGL_gl_LIBRARY)
157 OPENGL_xmesa_INCLUDE_DIR