diff options
author | Clinton Stimpson <clinton@elemtech.com> | 2008-03-14 17:16:58 (GMT) |
---|---|---|
committer | Clinton Stimpson <clinton@elemtech.com> | 2008-03-14 17:16:58 (GMT) |
commit | 58a2872f2eec36ff85a4c9f16b79b7b8a69a5424 (patch) | |
tree | 5546511ecb4f13cef90e363efabc0e8f5118253d /Modules/UseQt4.cmake | |
parent | f4c319b60bdb75d67ade6429da8d41eae3dbc96c (diff) | |
download | CMake-58a2872f2eec36ff85a4c9f16b79b7b8a69a5424.zip CMake-58a2872f2eec36ff85a4c9f16b79b7b8a69a5424.tar.gz CMake-58a2872f2eec36ff85a4c9f16b79b7b8a69a5424.tar.bz2 |
ENH: Automatically add dependent modules.
For example, if QT_USE_QTXMLPATTERNS is on, QT_USE_QTNETWORK is turned on.
The equivalent happens in a qmake .pro file when QT += xmlpatterns is specified.
Diffstat (limited to 'Modules/UseQt4.cmake')
-rw-r--r-- | Modules/UseQt4.cmake | 136 |
1 files changed, 41 insertions, 95 deletions
diff --git a/Modules/UseQt4.cmake b/Modules/UseQt4.cmake index 805968d..1a60714 100644 --- a/Modules/UseQt4.cmake +++ b/Modules/UseQt4.cmake @@ -20,105 +20,51 @@ IF (QT_USE_QTMAIN) ENDIF (WIN32) ENDIF (QT_USE_QTMAIN) -# Macro for setting up compile flags for Qt modules -MACRO(QT_MODULE_SETUP module) - IF (QT_QT${module}_FOUND) - ADD_DEFINITIONS(-DQT_${module}_LIB) - INCLUDE_DIRECTORIES(${QT_QT${module}_INCLUDE_DIR}) - SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_QT${module}_LIBRARY} ${QT_${module}_LIB_DEPENDENCIES}) - ELSE (QT_QT${module}_FOUND) - MESSAGE("Qt ${module} library not found.") - ENDIF (QT_QT${module}_FOUND) -ENDMACRO(QT_MODULE_SETUP) - - -# Qt modules (in order of dependence) +IF(QT_DONT_USE_QTGUI) + SET(QT_USE_QTGUI 0) +ELSE(QT_DONT_USE_QTGUI) + SET(QT_USE_QTGUI 1) +ENDIF(QT_DONT_USE_QTGUI) + +IF(QT_DONT_USE_QTCORE) + SET(QT_USE_QTCORE 0) +ELSE(QT_DONT_USE_QTCORE) + SET(QT_USE_QTCORE 1) +ENDIF(QT_DONT_USE_QTCORE) IF (QT_USE_QT3SUPPORT) - QT_MODULE_SETUP(3SUPPORT) ADD_DEFINITIONS(-DQT3_SUPPORT) ENDIF (QT_USE_QT3SUPPORT) -IF (QT_USE_QTOPENGL) - QT_MODULE_SETUP(OPENGL) -ENDIF (QT_USE_QTOPENGL) - -IF (QT_USE_QTASSISTANT) - QT_MODULE_SETUP(ASSISTANT) -ENDIF (QT_USE_QTASSISTANT) - -IF (QT_USE_QTDESIGNER) - QT_MODULE_SETUP(DESIGNER) -ENDIF (QT_USE_QTDESIGNER) - -IF (QT_USE_QTMOTIF) - QT_MODULE_SETUP(MOTIF) -ENDIF (QT_USE_QTMOTIF) - -IF (QT_USE_QTNSPLUGIN) - QT_MODULE_SETUP(NSPLUGIN) -ENDIF (QT_USE_QTNSPLUGIN) - -IF (QT_USE_QTSCRIPT) - QT_MODULE_SETUP(SCRIPT) -ENDIF (QT_USE_QTSCRIPT) - -IF (QT_USE_QTSVG) - QT_MODULE_SETUP(SVG) -ENDIF (QT_USE_QTSVG) - -IF (QT_USE_QTUITOOLS) - QT_MODULE_SETUP(UITOOLS) -ENDIF (QT_USE_QTUITOOLS) - -IF (QT_USE_QTHELP) - QT_MODULE_SETUP(HELP) -ENDIF (QT_USE_QTHELP) - -IF (QT_USE_QTWEBKIT) - QT_MODULE_SETUP(WEBKIT) -ENDIF (QT_USE_QTWEBKIT) - -IF (QT_USE_PHONON) - IF (QT_PHONON_FOUND) - ADD_DEFINITIONS(-DQT_PHONON_LIB) - INCLUDE_DIRECTORIES(${QT_PHONON_INCLUDE_DIR}) - SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_PHONON_LIBRARY}) - ELSE (QT_PHONON_FOUND) - MESSAGE("Qt ${module} library not found.") - ENDIF (QT_PHONON_FOUND) -ENDIF (QT_USE_PHONON) - -IF (NOT QT_DONT_USE_QTGUI) - QT_MODULE_SETUP(GUI) -ENDIF (NOT QT_DONT_USE_QTGUI) - -IF (QT_USE_QTTEST) - QT_MODULE_SETUP(TEST) -ENDIF (QT_USE_QTTEST) - -IF (QT_USE_QTXML) - QT_MODULE_SETUP(XML) -ENDIF (QT_USE_QTXML) - -IF (QT_USE_QTSQL) - QT_MODULE_SETUP(SQL) -ENDIF (QT_USE_QTSQL) - -IF (QT_USE_QTXMLPATTERNS) - QT_MODULE_SETUP(XMLPATTERNS) -ENDIF (QT_USE_QTXMLPATTERNS) - -IF (QT_USE_QTNETWORK) - QT_MODULE_SETUP(NETWORK) -ENDIF (QT_USE_QTNETWORK) - -IF (QT_USE_QTDBUS) - QT_MODULE_SETUP(DBUS) -ENDIF (QT_USE_QTDBUS) - -IF (NOT QT_DONT_USE_QTCORE) - QT_MODULE_SETUP(CORE) -ENDIF (NOT QT_DONT_USE_QTCORE) +# list dependent modules, so their modules are automatically on +SET(QT_QT3SUPPORT_MODULE_DEPENDS QTGUI QTSQL QTXML QTNETWORK QTCORE) +SET(QT_QTSVG_MODULE_DEPENDS QTGUI QTXML QTCORE) +SET(QT_QTUITOOLS_MODULE_DEPENDS QTGUI QTXML QTCORE) +SET(QT_QTHELP_MODULE_DEPENDS QTGUI QTSQL QTXML QTCORE) +SET(QT_PHONON_MODULE_DEPENDS QTGUI QTDBUS QTCORE) +SET(QT_QTDBUS_MODULE_DEPENDS QTXML QTCORE) +SET(QT_QTXMLPATTERNS_MODULE_DEPENDS QTNETWORK QTCORE) +# Qt modules (in order of dependence) +FOREACH(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN + QTSCRIPT QTSVG QTUITOOLS QTHELP QTWEBKIT PHONON QTGUI QTTEST + QTDBUS QTXML QTSQL QTXMLPATTERNS QTNETWORK QTCORE) + + IF (QT_USE_${module}) + IF (QT_${module}_FOUND) + IF(QT_USE_${module}) + STRING(REPLACE "QT" "" qt_module_def "${module}") + ADD_DEFINITIONS(-DQT_${qt_module_def}_LIB) + INCLUDE_DIRECTORIES(${QT_${module}_INCLUDE_DIR}) + ENDIF(QT_USE_${module}) + SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY} ${QT_${module}_LIB_DEPENDENCIES}) + FOREACH(depend_module ${QT_${module}_MODULE_DEPENDS}) + SET(QT_USE_${depend_module} 1) + ENDFOREACH(depend_module ${QT_${module}_MODULE_DEPENDS}) + ELSE (QT_${module}_FOUND) + MESSAGE("Qt ${module} library not found.") + ENDIF (QT_${module}_FOUND) + ENDIF (QT_USE_${module}) + +ENDFOREACH(module) |