From f318b5bc9d3c77f24930ac0d3e143f742dc04aec Mon Sep 17 00:00:00 2001 From: Tony Date: Tue, 1 Apr 2014 23:01:18 +0100 Subject: [PATCH] Improve GTK+ library selection logic. The new logic will select GTK+3 by default if WITH_GTK is selected. If the GTK+3 libraries are not found, then GTK+2 libraries will be selected if found. This can be overridden by using WITH_GTK_2_X to force selection of GTK+2 (if found). --- cmake/OpenCVFindLibsGUI.cmake | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/cmake/OpenCVFindLibsGUI.cmake b/cmake/OpenCVFindLibsGUI.cmake index 65847e5..c9f3fbb 100644 --- a/cmake/OpenCVFindLibsGUI.cmake +++ b/cmake/OpenCVFindLibsGUI.cmake @@ -41,18 +41,14 @@ endif() # --- GTK --- ocv_clear_vars(HAVE_GTK HAVE_GTK3 HAVE_GTHREAD HAVE_GTKGLEXT) if(WITH_GTK AND NOT HAVE_QT) - if(WITH_GTK_2_X) + if(NOT WITH_GTK_2_X) + CHECK_MODULE(gtk+-3.0 HAVE_GTK3) + set(HAVE_GTK TRUE) + elseif(NOT HAVE_GTK3) 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)") endif() - else() - CHECK_MODULE(gtk+-3.0 HAVE_GTK3) - if(HAVE_GTK3) - set(HAVE_GTK ON) - else() - message(WARNING "Unable to locate GTK3 development libraries") - endif() endif() CHECK_MODULE(gthread-2.0 HAVE_GTHREAD) if(HAVE_GTK OR HAVE_GTK3 AND NOT HAVE_GTHREAD) -- 2.7.4