From ad5a455bb576c52a3e7ad55af797c25d8ebf9147 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Mon, 21 Sep 2009 23:07:44 -0400 Subject: [PATCH] Fix issue 9581. Qt 4.5+ needs gobject-2.0. --- Modules/FindQt4.cmake | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 8326c9be7..c63f1a9ff 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -1544,6 +1544,33 @@ IF (QT4_QMAKE_FOUND) ${QT_GTHREAD_LIBRARY} ${QT_GLIB_LIBRARY}) ENDIF(QT_GLIB_LIBRARY AND QT_GTHREAD_LIBRARY) + + # Qt 4.5+ also links to gobject-2.0 + IF(QT_VERSION_MINOR GREATER 4) + IF(NOT QT_GOBJECT_LIBRARY) + EXECUTE_PROCESS(COMMAND pkg-config --libs-only-L gobject-2.0 + OUTPUT_VARIABLE _glib_query_output + RESULT_VARIABLE _glib_result + ERROR_VARIABLE _glib_query_output ) + + IF(_glib_result MATCHES 0) + STRING(REPLACE "-L" "" _glib_query_output "${_glib_query_output}") + SEPARATE_ARGUMENTS(_glib_query_output) + ELSE(_glib_result MATCHES 0) + SET(_glib_query_output) + ENDIF(_glib_result MATCHES 0) + + FIND_LIBRARY(QT_GOBJECT_LIBRARY NAMES gobject-2.0 PATHS ${_glib_query_output} ) + + MARK_AS_ADVANCED(QT_GOBJECT_LIBRARY) + ENDIF(NOT QT_GOBJECT_LIBRARY) + + IF(QT_GOBJECT_LIBRARY) + SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} + ${QT_GOBJECT_LIBRARY}) + ENDIF(QT_GOBJECT_LIBRARY) + ENDIF(QT_VERSION_MINOR GREATER 4) + ENDIF(QT_QCONFIG MATCHES "glib") ## clock-monotonic, just see if we need to link with rt