mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 07:13:02 +04:00
highgui: Fix unresolved OpenGL functions for Qt backend
The Qt backend directly calls some OpenGL functions (glClear, glHint, glViewport), but since OCV 4.5.5 the GL libraries are no longer part of the global extra dependencies. When linking with "-Wl,--no-undefined" this causes linker errors: `opencv-4.5.5/modules/highgui/src/window_QT.cpp:3307: undefined reference to `glClear'` Fixes: #21346 Related issues: #21299
This commit is contained in:
@@ -275,6 +275,10 @@ if(OPENCV_HIGHGUI_BUILTIN_BACKEND STREQUAL "WIN32UI" AND HAVE_OPENGL AND OPENGL_
|
||||
ocv_target_link_libraries(${the_module} PRIVATE "${OPENGL_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
if(OPENCV_HIGHGUI_BUILTIN_BACKEND MATCHES "^QT" AND HAVE_OPENGL AND OPENGL_LIBRARIES)
|
||||
ocv_target_link_libraries(${the_module} PRIVATE "${OPENGL_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
if(MSVC AND NOT BUILD_SHARED_LIBS AND BUILD_WITH_STATIC_CRT)
|
||||
set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /NODEFAULTLIB:libcmt.lib /DEBUG")
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user