diff options
author | Clinton Stimpson <clinton@elemtech.com> | 2008-03-19 20:14:06 (GMT) |
---|---|---|
committer | Clinton Stimpson <clinton@elemtech.com> | 2008-03-19 20:14:06 (GMT) |
commit | 44ad24c13a444f79091262b280d02ab3ca1ba013 (patch) | |
tree | a9deee693c22f0bc940c23948f47ed89bd4f1d44 /Modules | |
parent | 16b32f9c9b63eb837834773b7c7e7c8c6445cc2d (diff) | |
download | CMake-44ad24c13a444f79091262b280d02ab3ca1ba013.zip CMake-44ad24c13a444f79091262b280d02ab3ca1ba013.tar.gz CMake-44ad24c13a444f79091262b280d02ab3ca1ba013.tar.bz2 |
BUG: Fix issue when Qt from Linux distro is used
and glib and dbus development packages aren't installed.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindQt4.cmake | 90 |
1 files changed, 47 insertions, 43 deletions
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index cf87735..4d71824 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -1403,59 +1403,63 @@ IF (QT4_QMAKE_FOUND) ## qdbus IF(QT_QCONFIG MATCHES "qdbus") - EXECUTE_PROCESS(COMMAND pkg-config --libs-only-L dbus-1 - OUTPUT_VARIABLE _dbus_query_output - RESULT_VARIABLE _dbus_result - ERROR_VARIABLE _dbus_query_output ) - - IF(_dbus_result MATCHES 0) - STRING(REPLACE "-L" "" _dbus_query_output "${_dbus_query_output}") - SEPARATE_ARGUMENTS(_dbus_query_output) - ELSE(_dbus_result MATCHES 0) - MESSAGE(WARNING " When querying pkg-config for dbus-1. An error was reported:\n${_dbus_query_output}") - SET(_dbus_query_output) - ENDIF(_dbus_result MATCHES 0) - - FIND_LIBRARY(QT_DBUS_LIBRARY NAMES dbus-1 PATHS ${_dbus_query_output} ) - + # if the dbus library isn't found, we'll assume its not required to build + # shared Qt on Linux doesn't require it IF(NOT QT_DBUS_LIBRARY) - MESSAGE(WARNING " Unable to find dbus-1 to satisfy Qt dependency.") - ELSE(NOT QT_DBUS_LIBRARY) - SET(QT_QTDBUS_LIB_DEPENDENCIES ${QT_QTDBUS_LIB_DEPENDENCIES} ${QT_DBUS_LIBRARY}) + EXECUTE_PROCESS(COMMAND pkg-config --libs-only-L dbus-1 + OUTPUT_VARIABLE _dbus_query_output + RESULT_VARIABLE _dbus_result + ERROR_VARIABLE _dbus_query_output ) + + IF(_dbus_result MATCHES 0) + STRING(REPLACE "-L" "" _dbus_query_output "${_dbus_query_output}") + SEPARATE_ARGUMENTS(_dbus_query_output) + ELSE(_dbus_result MATCHES 0) + SET(_dbus_query_output) + ENDIF(_dbus_result MATCHES 0) + + FIND_LIBRARY(QT_DBUS_LIBRARY NAMES dbus-1 PATHS ${_dbus_query_output} ) + + IF(QT_DBUS_LIBRARY) + SET(QT_QTDBUS_LIB_DEPENDENCIES ${QT_QTDBUS_LIB_DEPENDENCIES} ${QT_DBUS_LIBRARY}) + ENDIF(QT_DBUS_LIBRARY) + + MARK_AS_ADVANCED(QT_DBUS_LIBRARY) ENDIF(NOT QT_DBUS_LIBRARY) - MARK_AS_ADVANCED(QT_DBUS_LIBRARY) - ENDIF(QT_QCONFIG MATCHES "qdbus") ## glib IF(QT_QCONFIG MATCHES "glib") - # 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) - MESSAGE(WARNING " When querying pkg-config for glib-2.0. An error was reported:\n${_glib_query_output}") - SET(_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 the glib libraries aren't found, we'll assume its not required to build + # shared Qt on Linux doesn't require it + # Qt 4.2.0+ uses glib-2.0 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_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} - ${QT_GTHREAD_LIBRARY} ${QT_GLIB_LIBRARY}) + 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) + 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(QT_GLIB_LIBRARY AND QT_GTHREAD_LIBRARY) + SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} + ${QT_GTHREAD_LIBRARY} ${QT_GLIB_LIBRARY}) + ENDIF(QT_GLIB_LIBRARY AND QT_GTHREAD_LIBRARY) + + MARK_AS_ADVANCED(QT_GLIB_LIBRARY) + MARK_AS_ADVANCED(QT_GTHREAD_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") ## clock-monotonic, just see if we need to link with rt |