An update will be applied January 25th, between 12PM and 1:00PM EST (UTC -5:00). The site may be slow during that time.

Commit b7804cb6 authored by Philipp Möller's avatar Philipp Möller Committed by Brad King
Browse files

FindOpenGL: Provide imported targets for GL and GLU

Create OpenGL::GL and OpenGL::GLU imported targets using the locations
found.
parent 0496c430
......@@ -4,6 +4,16 @@
#
# FindModule for OpenGL and GLU.
#
# IMPORTED Targets
# ^^^^^^^^^^^^^^^^
#
# This module defines the :prop_tgt:`IMPORTED` targets:
#
# ``OpenGL::OpenGL``
# Defined if the system has OpenGL.
# ``OpenGL::GLU``
# Defined if the system has GLU.
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
......@@ -181,6 +191,36 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGL REQUIRED_VARS ${_OpenGL_REQUIRED_VARS})
unset(_OpenGL_REQUIRED_VARS)
# OpenGL:: targets
if(OPENGL_FOUND)
if(NOT TARGET OpenGL::GL)
add_library(OpenGL::GL UNKNOWN IMPORTED)
set_target_properties(OpenGL::GL PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}")
if(OPENGL_gl_LIBRARY MATCHES "/([^/]+)\\.framework$")
set_target_properties(OpenGL::GL PROPERTIES
IMPORTED_LOCATION "${OPENGL_gl_LIBRARY}/${CMAKE_MATCH_1}")
else()
set_target_properties(OpenGL::GL PROPERTIES
IMPORTED_LOCATION "${OPENGL_gl_LIBRARY}")
endif()
endif()
if(OPENGL_GLU_FOUND AND NOT TARGET OpenGL::GLU)
add_library(OpenGL::GLU UNKNOWN IMPORTED)
set_target_properties(OpenGL::GLU PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES OpenGL::GL)
if(OPENGL_glu_LIBRARY MATCHES "/([^/]+)\\.framework$")
set_target_properties(OpenGL::GLU PROPERTIES
IMPORTED_LOCATION "${OPENGL_glu_LIBRARY}/${CMAKE_MATCH_1}")
else()
set_target_properties(OpenGL::GLU PROPERTIES
IMPORTED_LOCATION "${OPENGL_glu_LIBRARY}")
endif()
endif()
endif()
mark_as_advanced(
OPENGL_INCLUDE_DIR
OPENGL_xmesa_INCLUDE_DIR
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment