From c0dbc083ea0d13999de1d3d98d5ab33e0dc4a11d Mon Sep 17 00:00:00 2001 From: Tony Date: Wed, 9 Apr 2014 22:07:59 +0100 Subject: [PATCH] Correct error with GTK3 not found selection When GTK3 is not found, HAVE_GTK was being set to TRUE. This edit ensures that HAVE_GTK is only set if GTK3 or GTK2 (meeting minimum version requirements) is present. Selection logic for printing 'GTK: No' when the libraries are not found has also been removed so the message is printed when GTK is not found or selected in common with other libraries. Changes committed: modified: CMakeLists.txt modified: cmake/OpenCVFindLibsGUI.cmake --- CMakeLists.txt | 10 +++++++++- cmake/OpenCVFindLibsGUI.cmake | 7 ++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b5ccd7..c081649 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 c9f3fbb..f44261c 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) -- 2.7.4