diff options
Diffstat (limited to 'cmake/modules/FindOpenGl.cmake')
-rw-r--r-- | cmake/modules/FindOpenGl.cmake | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/cmake/modules/FindOpenGl.cmake b/cmake/modules/FindOpenGl.cmake index 1af7469e18..57cae1597c 100644 --- a/cmake/modules/FindOpenGl.cmake +++ b/cmake/modules/FindOpenGl.cmake @@ -5,9 +5,9 @@ # # This will define the following target: # -# OpenGL::GL - The OpenGL library +# ${APP_NAME_LC}::OpenGl - The OpenGL library -if(NOT TARGET OpenGL::GL) +if(NOT TARGET ${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME}) find_package(PkgConfig) if(PKG_CONFIG_FOUND) pkg_check_modules(PC_OPENGL gl QUIET) @@ -15,22 +15,19 @@ if(NOT TARGET OpenGL::GL) find_library(OPENGL_gl_LIBRARY NAMES GL OpenGL HINTS ${PC_OPENGL_gl_LIBDIR} ${CMAKE_OSX_SYSROOT}/System/Library - PATH_SUFFIXES Frameworks - NO_CACHE) + PATH_SUFFIXES Frameworks) find_path(OPENGL_INCLUDE_DIR NAMES GL/gl.h gl.h - HINTS ${PC_OPENGL_gl_INCLUDEDIR} ${OPENGL_gl_LIBRARY}/Headers - NO_CACHE) + HINTS ${PC_OPENGL_gl_INCLUDEDIR} ${OPENGL_gl_LIBRARY}/Headers) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(OpenGl REQUIRED_VARS OPENGL_gl_LIBRARY OPENGL_INCLUDE_DIR) if(OPENGL_FOUND) - add_library(OpenGL::GL UNKNOWN IMPORTED) - set_target_properties(OpenGL::GL PROPERTIES - IMPORTED_LOCATION "${OPENGL_gl_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}" - INTERFACE_COMPILE_DEFINITIONS HAS_GL=1) - set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP OpenGL::GL) + add_library(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} UNKNOWN IMPORTED) + set_target_properties(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} PROPERTIES + IMPORTED_LOCATION "${OPENGL_gl_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAS_GL) endif() endif() |