Fix linking with EGL under Cygwin in CMake builds

Link with OPENGL_egl_LIBRARY if OpenGL::EGL is not defined.

Closes #23673.
This commit is contained in:
Carlo Bramini 2023-07-04 01:37:15 +02:00 committed by Vadim Zeitlin
parent aa77eb91b0
commit 590cd0bd18

View file

@ -424,6 +424,11 @@ if(wxUSE_GUI)
if(WXGTK3 AND OpenGL_EGL_FOUND AND wxUSE_GLCANVAS_EGL)
if(TARGET OpenGL::EGL)
set(OPENGL_LIBRARIES OpenGL::EGL ${OPENGL_LIBRARIES})
else()
# It's possible for OpenGL::EGL not to be set even when EGL
# is found, at least under Cygwin (see #23673), so use the
# library directly like this to avoid link problems.
set(OPENGL_LIBRARIES ${OPENGL_egl_LIBRARY} ${OPENGL_LIBRARIES})
endif()
set(OPENGL_INCLUDE_DIR ${OPENGL_INCLUDE_DIR} ${OPENGL_EGL_INCLUDE_DIRS})
find_package(WAYLANDEGL)