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).
pull/1552/head
Tony 11 years ago
parent 1638341270
commit f318b5bc9d
  1. 12
      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)

Loading…
Cancel
Save