diff options
author | Brad King <brad.king@kitware.com> | 2013-01-31 14:58:50 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-01-31 14:58:50 (GMT) |
commit | 118c32f8f211b0bb9a096fbb0711cacf2b68f057 (patch) | |
tree | d72f1f0bc3aeea7ab9c95f130f7de435fc2cf262 /Modules/FindQt4.cmake | |
parent | cf8645e82dbb7dff434b14bd127c5457745e4db8 (diff) | |
parent | f447db7f102519e09258f0bd06668a9ae572ec68 (diff) | |
download | CMake-118c32f8f211b0bb9a096fbb0711cacf2b68f057.zip CMake-118c32f8f211b0bb9a096fbb0711cacf2b68f057.tar.gz CMake-118c32f8f211b0bb9a096fbb0711cacf2b68f057.tar.bz2 |
Merge branch 'xcode-duplicate-flags-13354' into generator-toolset
Diffstat (limited to 'Modules/FindQt4.cmake')
-rw-r--r-- | Modules/FindQt4.cmake | 103 |
1 files changed, 92 insertions, 11 deletions
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 00e86e8..7baa11b 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -418,6 +418,15 @@ macro (_QT4_ADJUST_LIB_VARS _camelCaseBasename) set_property(TARGET Qt4::${_camelCaseBasename} PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" ) endif() endif () + set_property(TARGET Qt4::${_camelCaseBasename} PROPERTY + INTERFACE_INCLUDE_DIRECTORIES + "${QT_${basename}_INCLUDE_DIR}" + ) + string(REGEX REPLACE "^QT" "" _stemname ${basename}) + set_property(TARGET Qt4::${_camelCaseBasename} PROPERTY + INTERFACE_COMPILE_DEFINITIONS + "QT_${_stemname}_LIB" + ) endif() # If QT_USE_IMPORTED_TARGETS is enabled, the QT_QTFOO_LIBRARY variables are set to point at these @@ -538,6 +547,11 @@ endif () if (QT_QMAKE_EXECUTABLE AND QTVERSION) + # set version variables + string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${QTVERSION}") + string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${QTVERSION}") + string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${QTVERSION}") + # ask qmake for the mkspecs directory # we do this first because QT_LIBINFIX might be set if (NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED) @@ -942,12 +956,49 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) ############################################ + macro(_qt4_add_target_depends_internal _QT_MODULE _PROPERTY) + if (TARGET Qt4::${_QT_MODULE}) + foreach(_DEPEND ${ARGN}) + if (NOT TARGET Qt4::Qt${_DEPEND}) + message(FATAL_ERROR "_qt4_add_target_depends invoked with invalid arguments") + endif() + set_property(TARGET Qt4::${_QT_MODULE} APPEND PROPERTY + ${_PROPERTY} + "Qt4::Qt${_DEPEND}" + ) + set_property(TARGET Qt4::${_QT_MODULE} APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES + "$<TARGET_PROPERTY:Qt4::Qt${_DEPEND},INTERFACE_INCLUDE_DIRECTORIES>" + ) + set_property(TARGET Qt4::${_QT_MODULE} APPEND PROPERTY + INTERFACE_COMPILE_DEFINITIONS + "$<TARGET_PROPERTY:Qt4::Qt${_DEPEND},INTERFACE_COMPILE_DEFINITIONS>" + ) + endforeach() + endif() + endmacro() + + macro(_qt4_add_target_depends _QT_MODULE) + _qt4_add_target_depends_internal(${_QT_MODULE} IMPORTED_LINK_INTERFACE_LIBRARIES ${ARGN}) + endmacro() + + macro(_qt4_add_target_private_depends _QT_MODULE) + _qt4_add_target_depends_internal(${_QT_MODULE} IMPORTED_LINK_DEPENDENT_LIBRARIES ${ARGN}) + endmacro() + + # Set QT_xyz_LIBRARY variable and add # library include path to QT_INCLUDES _QT4_ADJUST_LIB_VARS(QtCore) + set_property(TARGET Qt4::QtCore APPEND PROPERTY + INTERFACE_INCLUDE_DIRECTORIES + "${QT_MKSPECS_DIR}/default" + ${QT_INCLUDE_DIR} + ) foreach(QT_MODULE ${QT_MODULES}) _QT4_ADJUST_LIB_VARS(${QT_MODULE}) + _qt4_add_target_depends(${QT_MODULE} Core) endforeach() _QT4_ADJUST_LIB_VARS(QtAssistant) @@ -962,6 +1013,41 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) _QT4_ADJUST_LIB_VARS(QAxContainer) endif() + # Only public dependencies are listed here. + # Eg, QtDBus links to QtXml, but users of QtDBus do not need to + # link to QtXml because QtDBus only uses it internally, not in public + # headers. + # Everything depends on QtCore, but that is covered above already + _qt4_add_target_depends(Qt3Support Sql Gui Network) + if (TARGET Qt4::Qt3Support) + # An additional define is required for QT3_SUPPORT + set_property(TARGET Qt4::Qt3Support APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS QT3_SUPPORT) + endif() + _qt4_add_target_depends(QtDeclarative Script Gui) + _qt4_add_target_depends(QtDesigner Gui) + _qt4_add_target_depends(QtHelp Gui) + _qt4_add_target_depends(QtMultimedia Gui) + _qt4_add_target_depends(QtOpenGL Gui) + _qt4_add_target_depends(QtSvg Gui) + _qt4_add_target_depends(QtWebKit Gui Network) + + _qt4_add_target_private_depends(Qt3Support Xml) + _qt4_add_target_private_depends(QtSvg Xml) + _qt4_add_target_private_depends(QtDBus Xml) + _qt4_add_target_private_depends(QtUiTools Xml Gui) + _qt4_add_target_private_depends(QtHelp Sql Xml Network) + _qt4_add_target_private_depends(QtXmlPatterns Network) + _qt4_add_target_private_depends(QtScriptTools Gui) + _qt4_add_target_private_depends(QtWebKit XmlPatterns) + _qt4_add_target_private_depends(QtDeclarative XmlPatterns Svg Sql Gui) + _qt4_add_target_private_depends(QtMultimedia Gui) + _qt4_add_target_private_depends(QtOpenGL Gui) + _qt4_add_target_private_depends(QAxServer Gui) + _qt4_add_target_private_depends(QAxContainer Gui) + _qt4_add_target_private_depends(phonon Gui) + if(QT_QTDBUS_FOUND) + _qt4_add_target_private_depends(phonon DBus) + endif() ####################################### # @@ -986,13 +1072,13 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) endif() find_program(QT_MOC_EXECUTABLE - NAMES moc-qt4 moc + NAMES moc-qt4 moc moc4 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) find_program(QT_UIC_EXECUTABLE - NAMES uic-qt4 uic + NAMES uic-qt4 uic uic4 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) @@ -1022,13 +1108,13 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) ) find_program(QT_LUPDATE_EXECUTABLE - NAMES lupdate-qt4 lupdate + NAMES lupdate-qt4 lupdate lupdate4 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) find_program(QT_LRELEASE_EXECUTABLE - NAMES lrelease-qt4 lrelease + NAMES lrelease-qt4 lrelease lrelease4 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) @@ -1040,13 +1126,13 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) ) find_program(QT_DESIGNER_EXECUTABLE - NAMES designer-qt4 designer + NAMES designer-qt4 designer designer4 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) find_program(QT_LINGUIST_EXECUTABLE - NAMES linguist-qt4 linguist + NAMES linguist-qt4 linguist linguist4 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) @@ -1174,11 +1260,6 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) include("${_qt4_current_dir}/Qt4Macros.cmake") - # set version variables - string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${QTVERSION}") - string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${QTVERSION}") - string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${QTVERSION}") - endif() #support old QT_MIN_VERSION if set, but not if version is supplied by find_package() |