CMake: Check for OpenGL in imported target

The gl target uses OpenGL libraries, so these must be defined.
Previously, the user has to do this before importing the wxWidget target.
This commit is contained in:
Maarten Bent 2024-01-28 14:06:11 +01:00
parent a63ba1cc04
commit 302ad5f7cd
No known key found for this signature in database
GPG key ID: 58AAEE3F4A4FD070

View file

@ -127,6 +127,12 @@ foreach(libname @wxLIB_TARGETS@)
endif()
endforeach()
if(TARGET wx::wxgl)
# make sure OpenGL targets are available:
# The link interface of target "wx::wxgl" contains: OpenGL::GLU
find_package(OpenGL QUIET)
endif()
# if no components are specified in find_package, check all of them
if(NOT @PROJECT_NAME@_FIND_COMPONENTS)
set(@PROJECT_NAME@_FIND_COMPONENTS ${@PROJECT_NAME@_COMPONENTS})