From e28c6eb3b64a21e0239d556de9dce1620cb9a3bd Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Wed, 3 Jul 2024 19:22:06 +0300 Subject: [PATCH] Fixed gtkglext search in cmake. --- modules/highgui/cmake/detect_gtk.cmake | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/highgui/cmake/detect_gtk.cmake b/modules/highgui/cmake/detect_gtk.cmake index 5e9412d427..b7f53d1a9b 100644 --- a/modules/highgui/cmake/detect_gtk.cmake +++ b/modules/highgui/cmake/detect_gtk.cmake @@ -29,7 +29,15 @@ if(WITH_GTK) if((WITH_OPENGL OR HAVE_OPENGL) AND HAVE_GTK2) ocv_check_modules(GTKGLEXT gtkglext-1.0) if(HAVE_GTKGLEXT) - ocv_add_external_target(gtkglext "${GTKGLEXT_INCLUDE_DIRS}" "${GTKGLEXT_LIBRARIES}" "HAVE_GTKGLEXT") + # HACK for https://github.com/opencv/opencv/issues/20850 + # pkg-config reports some include directories that do not exist. Just filter them out. + set(GTKGLEXT_INCLUDE_DIRS_EXISTS "") + foreach(p ${GTKGLEXT_INCLUDE_DIRS}) + if (EXISTS "${p}") + list(APPEND GTKGLEXT_INCLUDE_DIRS_EXISTS "${p}") + endif() + endforeach() + ocv_add_external_target(gtkglext "${GTKGLEXT_INCLUDE_DIRS_EXISTS}" "${GTKGLEXT_LIBRARIES}" "HAVE_GTKGLEXT") endif() endif() elseif(HAVE_GTK)