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).
This commit is contained in:
Tony 2014-04-01 23:01:18 +01:00
parent 7f671406db
commit 7daec9e9a8

View File

@ -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)