Debian Codegraph @

FindOpenGl.cmake

raw
1 #.rst:
2 # FindOpenGl
3 # ----------
4 # Finds the FindOpenGl library
5 #
6 # This will define the following variables::
7 #
8 # OPENGL_FOUND - system has OpenGl
9 # OPENGL_INCLUDE_DIRS - the OpenGl include directory
10 # OPENGL_LIBRARIES - the OpenGl libraries
11 # OPENGL_DEFINITIONS - the OpenGl definitions
12
13 if(PKG_CONFIG_FOUND)
14 pkg_check_modules(PC_OPENGL gl QUIET)
15 endif()
16
17 if(NOT CORE_SYSTEM_NAME STREQUAL osx)
18 find_path(OPENGL_INCLUDE_DIR GL/gl.h
19 PATHS ${PC_OPENGL_gl_INCLUDEDIR})
20 find_library(OPENGL_gl_LIBRARY NAMES GL
21 PATHS ${PC_OPENGL_gl_LIBDIR})
22 else()
23 find_library(OPENGL_gl_LIBRARY NAMES OpenGL
24 PATHS ${CMAKE_OSX_SYSROOT}/System/Library
25 PATH_SUFFIXES Frameworks
26 NO_DEFAULT_PATH)
27 set(OPENGL_INCLUDE_DIR ${OPENGL_gl_LIBRARY}/Headers)
28 endif()
29
30 include(FindPackageHandleStandardArgs)
31 find_package_handle_standard_args(OpenGl
32 REQUIRED_VARS OPENGL_gl_LIBRARY OPENGL_INCLUDE_DIR)
33
34 if(OPENGL_FOUND)
35 set(OPENGL_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
36 set(OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY})
37 set(OPENGL_DEFINITIONS -DHAS_GL=1)
38 endif()
39
40 mark_as_advanced(OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY)