Correct error with GTK3 not found selection
authorTony <exocoder@gmail.com>
Wed, 9 Apr 2014 21:07:59 +0000 (22:07 +0100)
committerTony <exocoder@gmail.com>
Wed, 9 Apr 2014 21:07:59 +0000 (22:07 +0100)
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
cmake/OpenCVFindLibsGUI.cmake

index e8e75bf..1e47bbc 100644 (file)
@@ -752,11 +752,9 @@ else()
       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)
+        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()
+        status("    GTK+:" NO)
       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)
index a1da6f6..0ae3787 100644 (file)
@@ -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)