diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b5ccd73e7..c081649501 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -748,7 +748,15 @@ else() status(" Cocoa:" YES) endif() else() - status(" GTK+ 2.x:" HAVE_GTK THEN "YES (ver ${ALIASOF_gtk+-2.0_VERSION})" ELSE NO) + if(HAVE_GTK3) + status(" GTK+ 3.x:" HAVE_GTK THEN "YES (ver ${ALIASOF_gtk+-3.0_VERSION})" ELSE NO) + elseif(HAVE_GTK) + status(" GTK+ 2.x:" HAVE_GTK THEN "YES (ver ${ALIASOF_gtk+-2.0_VERSION})" ELSE NO) + else() + if(DEFINED WITH_GTK) + staus(" GTK+:" NO) + endif() + endif() status(" GThread :" HAVE_GTHREAD THEN "YES (ver ${ALIASOF_gthread-2.0_VERSION})" ELSE NO) status(" GtkGlExt:" HAVE_GTKGLEXT THEN "YES (ver ${ALIASOF_gtkglext-1.0_VERSION})" ELSE NO) endif() diff --git a/cmake/OpenCVFindLibsGUI.cmake b/cmake/OpenCVFindLibsGUI.cmake index c9f3fbb6ba..f44261c3c1 100644 --- a/cmake/OpenCVFindLibsGUI.cmake +++ b/cmake/OpenCVFindLibsGUI.cmake @@ -43,15 +43,16 @@ ocv_clear_vars(HAVE_GTK HAVE_GTK3 HAVE_GTHREAD HAVE_GTKGLEXT) if(WITH_GTK AND NOT HAVE_QT) if(NOT WITH_GTK_2_X) CHECK_MODULE(gtk+-3.0 HAVE_GTK3) - set(HAVE_GTK TRUE) - elseif(NOT HAVE_GTK3) + set(HAVE_GTK HAVE_GTK3) + else() CHECK_MODULE(gtk+-2.0 HAVE_GTK) if(HAVE_GTK AND (ALIASOF_gtk+-2.0_VERSION VERSION_LESS MIN_VER_GTK)) message (FATAL_ERROR "GTK support requires a minimum version of ${MIN_VER_GTK} (${ALIASOF_gtk+-2.0_VERSION} found)") + set(HAVE_GTK FALSE) endif() endif() CHECK_MODULE(gthread-2.0 HAVE_GTHREAD) - if(HAVE_GTK OR HAVE_GTK3 AND NOT HAVE_GTHREAD) + if(HAVE_GTK AND NOT HAVE_GTHREAD) message(FATAL_ERROR "gthread not found. This library is required when building with GTK support") endif() if(WITH_OPENGL AND NOT HAVE_GTK3)