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.
This commit is contained in:
Clinton Stimpson 2008-03-14 13:16:58 -04:00
parent f4c319b60b
commit 58a2872f2e
2 changed files with 62 additions and 116 deletions

View File

@ -1267,9 +1267,9 @@ IF (QT4_QMAKE_FOUND)
#
###############################################
SET(QT_GUI_LIB_DEPENDENCIES "")
SET(QT_CORE_LIB_DEPENDENCIES "")
SET(QT_HELP_LIB_DEPENDENCIES ${QT_QTCLUCENE_LIBRARY})
SET(QT_QTGUI_LIB_DEPENDENCIES "")
SET(QT_QTCORE_LIB_DEPENDENCIES "")
SET(QT_QTHELP_LIB_DEPENDENCIES ${QT_QTCLUCENE_LIBRARY})
# build using shared Qt needs -DQT_DLL
IF(NOT QT_CONFIG MATCHES "static")
@ -1281,7 +1281,7 @@ IF (QT4_QMAKE_FOUND)
## system png
IF(QT_QCONFIG MATCHES "system-png")
FIND_LIBRARY(QT_PNG_LIBRARY NAMES png)
SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_PNG_LIBRARY})
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_PNG_LIBRARY})
MARK_AS_ADVANCED(QT_PNG_LIBRARY)
ENDIF(QT_QCONFIG MATCHES "system-png")
@ -1295,7 +1295,7 @@ IF (QT4_QMAKE_FOUND)
# ask qmake where the x11 libs are
FIND_LIBRARY(QT_X11_SM_LIBRARY NAMES SM PATHS ${QMAKE_LIBDIR_X11})
FIND_LIBRARY(QT_X11_ICE_LIBRARY NAMES ICE PATHS ${QMAKE_LIBDIR_X11})
SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_X11_SM_LIBRARY} ${QT_X11_ICE_LIBRARY})
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_X11_SM_LIBRARY} ${QT_X11_ICE_LIBRARY})
MARK_AS_ADVANCED(QT_X11_SM_LIBRARY)
MARK_AS_ADVANCED(QT_X11_ICE_LIBRARY)
ENDIF(QT_QCONFIG MATCHES "x11sm")
@ -1303,63 +1303,63 @@ IF (QT4_QMAKE_FOUND)
## Xi
IF(QT_QCONFIG MATCHES "tablet")
FIND_LIBRARY(QT_XI_LIBRARY NAMES Xi PATHS ${QMAKE_LIBDIR_X11})
SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_XI_LIBRARY})
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XI_LIBRARY})
MARK_AS_ADVANCED(QT_XI_LIBRARY)
ENDIF(QT_QCONFIG MATCHES "tablet")
## Xrender
IF(QT_QCONFIG MATCHES "xrender")
FIND_LIBRARY(QT_XRENDER_LIBRARY NAMES Xrender PATHS ${QMAKE_LIBDIR_X11})
SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_XRENDER_LIBRARY})
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XRENDER_LIBRARY})
MARK_AS_ADVANCED(QT_XRENDER_LIBRARY)
ENDIF(QT_QCONFIG MATCHES "xrender")
## Xrandr
IF(QT_QCONFIG MATCHES "xrandr")
FIND_LIBRARY(QT_XRANDR_LIBRARY NAMES Xrandr PATHS ${QMAKE_LIBDIR_X11})
SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_XRANDR_LIBRARY})
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XRANDR_LIBRARY})
MARK_AS_ADVANCED(QT_XRANDR_LIBRARY)
ENDIF(QT_QCONFIG MATCHES "xrandr")
## Xcursor
IF(QT_QCONFIG MATCHES "xcursor")
FIND_LIBRARY(QT_XCURSOR_LIBRARY NAMES Xcursor PATHS ${QMAKE_LIBDIR_X11})
SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_XCURSOR_LIBRARY})
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XCURSOR_LIBRARY})
MARK_AS_ADVANCED(QT_XCURSOR_LIBRARY)
ENDIF(QT_QCONFIG MATCHES "xcursor")
## Xinerama
IF(QT_QCONFIG MATCHES "xinerama")
FIND_LIBRARY(QT_XINERAMA_LIBRARY NAMES Xinerama PATHS ${QMAKE_LIBDIR_X11})
SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_XINERAMA_LIBRARY})
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XINERAMA_LIBRARY})
MARK_AS_ADVANCED(QT_XINERAMA_LIBRARY)
ENDIF(QT_QCONFIG MATCHES "xinerama")
## Xfixes
IF(QT_QCONFIG MATCHES "xfixes")
FIND_LIBRARY(QT_XFIXES_LIBRARY NAMES Xfixes PATHS ${QMAKE_LIBDIR_X11})
SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_XFIXES_LIBRARY})
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XFIXES_LIBRARY})
MARK_AS_ADVANCED(QT_XFIXES_LIBRARY)
ENDIF(QT_QCONFIG MATCHES "xfixes")
## system-freetype
IF(QT_QCONFIG MATCHES "system-freetype")
FIND_LIBRARY(QT_FREETYPE_LIBRARY NAMES freetype)
SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_FREETYPE_LIBRARY})
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_FREETYPE_LIBRARY})
MARK_AS_ADVANCED(QT_FREETYPE_LIBRARY)
ENDIF(QT_QCONFIG MATCHES "system-freetype")
## fontconfig
IF(QT_QCONFIG MATCHES "fontconfig")
FIND_LIBRARY(QT_FONTCONFIG_LIBRARY NAMES fontconfig)
SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${QT_FONTCONFIG_LIBRARY})
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_FONTCONFIG_LIBRARY})
MARK_AS_ADVANCED(QT_FONTCONFIG_LIBRARY)
ENDIF(QT_QCONFIG MATCHES "fontconfig")
## system-zlib
IF(QT_QCONFIG MATCHES "system-zlib")
FIND_LIBRARY(QT_ZLIB_LIBRARY NAMES z)
SET(QT_CORE_LIB_DEPENDENCIES ${QT_CORE_LIB_DEPENDENCIES} ${QT_ZLIB_LIBRARY})
SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_ZLIB_LIBRARY})
MARK_AS_ADVANCED(QT_ZLIB_LIBRARY)
ENDIF(QT_QCONFIG MATCHES "system-zlib")
@ -1385,7 +1385,7 @@ IF (QT4_QMAKE_FOUND)
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}
SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES}
${QT_GTHREAD_LIBRARY} ${QT_GLIB_LIBRARY})
ENDIF(NOT QT_GLIB_LIBRARY OR NOT QT_GTHREAD_LIBRARY)
@ -1401,7 +1401,7 @@ IF (QT4_QMAKE_FOUND)
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE})
IF(QT_POSIX_TIMERS)
FIND_LIBRARY(QT_RT_LIBRARY NAMES rt)
SET(QT_CORE_LIB_DEPENDENCIES ${QT_CORE_LIB_DEPENDENCIES} ${QT_RT_LIBRARY})
SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_RT_LIBRARY})
MARK_AS_ADVANCED(QT_RT_LIBRARY)
ENDIF(QT_POSIX_TIMERS)
ENDIF(QT_QCONFIG MATCHES "clock-monotonic")
@ -1414,26 +1414,26 @@ IF (QT4_QMAKE_FOUND)
STRING(REGEX REPLACE "-l" "" QT_X11_LIB "${QT_X11_LIB}")
SET(QT_TMP_STR "QT_X11_${QT_X11_LIB}_LIBRARY")
FIND_LIBRARY(${QT_TMP_STR} NAMES "${QT_X11_LIB}" PATHS ${QMAKE_LIBDIR_X11})
SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} ${${QT_TMP_STR}})
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${${QT_TMP_STR}})
MARK_AS_ADVANCED(${QT_TMP_STR})
ENDFOREACH(QT_X11_LIB)
QT_QUERY_QMAKE(QT_LIBS_THREAD "QMAKE_LIBS_THREAD")
SET(QT_CORE_LIB_DEPENDENCIES ${QT_CORE_LIB_DEPENDENCIES} ${QT_LIBS_THREAD})
SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_LIBS_THREAD})
QT_QUERY_QMAKE(QMAKE_LIBS_DYNLOAD "QMAKE_LIBS_DYNLOAD")
SET (QT_CORE_LIB_DEPENDENCIES ${QT_CORE_LIB_DEPENDENCIES} ${QMAKE_LIBS_DYNLOAD})
SET (QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QMAKE_LIBS_DYNLOAD})
ENDIF(Q_WS_X11)
IF(Q_WS_WIN)
SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} imm32 winmm)
SET(QT_CORE_LIB_DEPENDENCIES ${QT_CORE_LIB_DEPENDENCIES} ws2_32)
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} imm32 winmm)
SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ws2_32)
ENDIF(Q_WS_WIN)
IF(Q_WS_MAC)
SET(QT_GUI_LIB_DEPENDENCIES ${QT_GUI_LIB_DEPENDENCIES} "-framework Carbon" "-framework QuickTime")
SET(QT_CORE_LIB_DEPENDENCIES ${QT_CORE_LIB_DEPENDENCIES} "-framework ApplicationServices")
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} "-framework Carbon" "-framework QuickTime")
SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} "-framework ApplicationServices")
ENDIF(Q_WS_MAC)
#######################################

View File

@ -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)
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)
# Qt modules (in order of dependence)
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)
# 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)
IF (QT_USE_QTASSISTANT)
QT_MODULE_SETUP(ASSISTANT)
ENDIF (QT_USE_QTASSISTANT)
# 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_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)
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)