Merge topic 'qt4-target-depends'
57a67bf
Qt4: Add module dependencies to the IMPORTED targets
This commit is contained in:
commit
0a097af097
|
@ -942,12 +942,36 @@ 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}"
|
||||
)
|
||||
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)
|
||||
|
||||
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 +986,37 @@ 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)
|
||||
_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()
|
||||
|
||||
#######################################
|
||||
#
|
||||
|
|
|
@ -989,6 +989,21 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
|
|||
)
|
||||
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/QtAutomoc")
|
||||
endif()
|
||||
if(QT4_WORKS AND QT_QTGUI_FOUND)
|
||||
add_test(Qt4Targets ${CMAKE_CTEST_COMMAND}
|
||||
--build-and-test
|
||||
"${CMake_SOURCE_DIR}/Tests/Qt4Targets"
|
||||
"${CMake_BINARY_DIR}/Tests/Qt4Targets"
|
||||
--build-generator ${CMAKE_TEST_GENERATOR}
|
||||
--build-project Qt4Targets
|
||||
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
|
||||
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4Targets"
|
||||
--force-new-ctest-process
|
||||
--build-options -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
|
||||
--test-command ${CMAKE_CTEST_COMMAND} -V
|
||||
)
|
||||
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Targets")
|
||||
endif()
|
||||
|
||||
add_test(ExternalProject ${CMAKE_CTEST_COMMAND}
|
||||
--build-and-test
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(Qt4Targets)
|
||||
|
||||
find_package(Qt4 REQUIRED)
|
||||
|
||||
include_directories(${QT_INCLUDES})
|
||||
|
||||
add_executable(Qt4Targets WIN32 main.cpp)
|
||||
target_link_libraries(Qt4Targets Qt4::QtGui)
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(Qt4Targets Qt4::qtmain)
|
||||
endif()
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
#include <QApplication>
|
||||
#include <QWidget>
|
||||
|
||||
#include <QString>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
QWidget w;
|
||||
w.setWindowTitle(QString::fromLatin1("SomeTitle"));
|
||||
w.show();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue