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
This commit is contained in:
Tony 2014-04-09 22:07:59 +01:00
parent 65f63421fa
commit c0dbc083ea
2 changed files with 13 additions and 4 deletions

View File

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

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