mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-15 02:49:42 -05:00
FindGLEW: Set documented variables when found via upstream package
When GLEW is found by `find_package` (most of) the variables described in the documentation of `FindGLEW` aren't set. That could lead to issues when building packages that rely on these variables. Fixes: #19662
This commit is contained in:
@@ -68,6 +68,30 @@ find_package(GLEW CONFIG QUIET)
|
||||
|
||||
if(GLEW_FOUND)
|
||||
find_package_handle_standard_args(GLEW DEFAULT_MSG GLEW_CONFIG)
|
||||
get_target_property(GLEW_INCLUDE_DIRS GLEW::GLEW INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(GLEW_INCLUDE_DIR ${GLEW_INCLUDE_DIRS})
|
||||
get_target_property(_GLEW_DEFS GLEW::GLEW INTERFACE_COMPILE_DEFINITIONS)
|
||||
if("${_GLEW_DEFS}" MATCHES "GLEW_STATIC")
|
||||
get_target_property(GLEW_LIBRARY_DEBUG GLEW::GLEW IMPORTED_LOCATION_DEBUG)
|
||||
get_target_property(GLEW_LIBRARY_RELEASE GLEW::GLEW IMPORTED_LOCATION_RELEASE)
|
||||
else()
|
||||
get_target_property(GLEW_LIBRARY_DEBUG GLEW::GLEW IMPORTED_IMPLIB_DEBUG)
|
||||
get_target_property(GLEW_LIBRARY_RELEASE GLEW::GLEW IMPORTED_IMPLIB_RELEASE)
|
||||
endif()
|
||||
get_target_property(_GLEW_LINK_INTERFACE GLEW::GLEW IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE) # same for debug and release
|
||||
list(APPEND GLEW_LIBRARIES ${_GLEW_LINK_INTERFACE})
|
||||
list(APPEND GLEW_LIBRARY ${_GLEW_LINK_INTERFACE})
|
||||
select_library_configurations(GLEW)
|
||||
if("${_GLEW_DEFS}" MATCHES "GLEW_STATIC")
|
||||
set(GLEW_STATIC_LIBRARIES ${GLEW_LIBRARIES})
|
||||
else()
|
||||
set(GLEW_SHARED_LIBRARIES ${GLEW_LIBRARIES})
|
||||
endif()
|
||||
unset(_GLEW_DEFS)
|
||||
unset(_GLEW_LINK_INTERFACE)
|
||||
unset(GLEW_LIBRARY)
|
||||
unset(GLEW_LIBRARY_DEBUG)
|
||||
unset(GLEW_LIBRARY_RELEASE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user