diff options
author | Clinton Stimpson <clinton@elemtech.com> | 2008-01-29 00:20:00 (GMT) |
---|---|---|
committer | Clinton Stimpson <clinton@elemtech.com> | 2008-01-29 00:20:00 (GMT) |
commit | 404db8811e4d6dc8ed89f4b1e3efafbb5985dc44 (patch) | |
tree | 3441ed6c7b27c50987340c8130f2049c690e9bb1 /Modules/FindQt4.cmake | |
parent | e75932b61f6f40531c70694b14c7e068a94d8da9 (diff) | |
download | CMake-404db8811e4d6dc8ed89f4b1e3efafbb5985dc44.zip CMake-404db8811e4d6dc8ed89f4b1e3efafbb5985dc44.tar.gz CMake-404db8811e4d6dc8ed89f4b1e3efafbb5985dc44.tar.bz2 |
ENH: Improve find for glib/gthread when Qt is configured to use it.
Fixes #6220.
Diffstat (limited to 'Modules/FindQt4.cmake')
-rw-r--r-- | Modules/FindQt4.cmake | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 72c6e9d..bbfb69e 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -1312,12 +1312,30 @@ IF (QT4_QMAKE_FOUND) ## glib IF(QT_QCONFIG MATCHES "glib") - # Qt less than Qt 4.2.0 doesn't use glib - # Qt 4.2.0 uses glib-2.0 (wish we could ask Qt that it uses 2.0) - FIND_LIBRARY(QT_GLIB_LIBRARY NAMES glib-2.0) - FIND_LIBRARY(QT_GTHREAD_LIBRARY NAMES gthread-2.0) - SET(QT_CORE_LIB_DEPENDENCIES ${QT_CORE_LIB_DEPENDENCIES} - ${QT_GTHREAD_LIBRARY} ${QT_GLIB_LIBRARY}) + # Qt 4.2.0+ uses glib-2.0 + EXECUTE_PROCESS(COMMAND pkg-config --libs-only-L glib-2.0 gthread-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) + MESSAGE(WARNING "When querying pkg-config for glib-2.0. An error was reported:\n${_glib_query_output}") + ENDIF(_glib_result MATCHES 0) + + FIND_LIBRARY(QT_GLIB_LIBRARY NAMES glib-2.0 PATHS ${_glib_query_output} ) + FIND_LIBRARY(QT_GTHREAD_LIBRARY NAMES gthread-2.0 PATHS ${_glib_query_output} ) + + IF(NOT QT_GLIB_LIBRARY OR NOT QT_GTHREAD_LIBRARY) + MESSAGE(WARNING "Unable to find glib 2.0 to satisfy Qt dependency.") + ELSE(NOT QT_GLIB_LIBRARY OR NOT QT_GTHREAD_LIBRARY) + SET(QT_CORE_LIB_DEPENDENCIES ${QT_CORE_LIB_DEPENDENCIES} + ${QT_GTHREAD_LIBRARY} ${QT_GLIB_LIBRARY}) + ENDIF(NOT QT_GLIB_LIBRARY OR NOT QT_GTHREAD_LIBRARY) + MARK_AS_ADVANCED(QT_GLIB_LIBRARY) MARK_AS_ADVANCED(QT_GTHREAD_LIBRARY) ENDIF(QT_QCONFIG MATCHES "glib") |