Fix build with CMake 3.16

Use FindOpenGL from CMake upstream which finds both OpenGL and EGL.

Fix linking by using OpenGL::GLX (instead of ${OPENGL_gl_LIBRARY} which is
set to an empty string when GLVND is used). Thanks to Ömer Fadıl Usta for
mentioning that in https://invent.kde.org/frameworks/plasma-framework/-/merge_requests/264

NO_CHANGELOG
This commit is contained in:
Ahmad Samir 2021-05-17 15:07:41 +02:00
parent 606144182c
commit a70957d96c
2 changed files with 6 additions and 8 deletions

View File

@ -102,12 +102,10 @@ set_package_properties(OpenGL PROPERTIES DESCRIPTION "The OpenGL libraries"
TYPE OPTIONAL
)
find_package(EGL)
set_package_properties(EGL PROPERTIES
PURPOSE "Support for Window Thumbnail on EGL platform"
TYPE OPTIONAL
)
set(HAVE_EGL ${EGL_FOUND})
add_feature_info(EGL ${OpenGL_EGL_FOUND}
"A platform-agnostic mechanism for creating rendering surfaces for use with other graphics libraries, such as OpenGL|ES and OpenVG.")
# OpenGL_EGL_FOUND is defined by FindOpenGL
set(HAVE_EGL ${OpenGL_EGL_FOUND})
if(OPENGL_FOUND AND (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL "GL"))
set(HAVE_GLX ${HAVE_X11})

View File

@ -53,12 +53,12 @@ if(HAVE_X11)
endif()
if(HAVE_GLX)
target_link_libraries(corebindingsplugin ${OPENGL_gl_LIBRARY})
target_link_libraries(corebindingsplugin OpenGL::GLX)
endif()
endif()
if(HAVE_EGL)
target_link_libraries(corebindingsplugin EGL::EGL)
target_link_libraries(corebindingsplugin OpenGL::EGL)
endif()
if (${Qt5Gui_OPENGL_IMPLEMENTATION} STREQUAL "GLESv2")