diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-05-27 15:58:57 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-05-27 23:19:37 (GMT) |
commit | fa55751f83dc5d5bd5f80d12c3076ec703262edb (patch) | |
tree | 7420d760cbeaad79622325d3b285a1b53d2c743f /Tests/CMakeLists.txt | |
parent | f77631672168b1e3b5fad93c2bb83db65cb67e7b (diff) | |
download | CMake-fa55751f83dc5d5bd5f80d12c3076ec703262edb.zip CMake-fa55751f83dc5d5bd5f80d12c3076ec703262edb.tar.gz CMake-fa55751f83dc5d5bd5f80d12c3076ec703262edb.tar.bz2 |
QtAutomoc: Get the Qt version through the target link interface
In Qt 5.1, Qt5::Core has a INTERFACE_QT_MAJOR_VERSION property
of '5', and since CMake 2.8.11, Qt4::QtCore has an
INTERFACE_QT_MAJOR_VERSION of '4'. This was introduced in
commit 4aa10cd6 (FindQt4: Set the INTERFACE_QT_MAJOR_VERSION for
Qt4::QtCore, 2013-03-16), to produce an error if Qt 4 and Qt 5
are erroneously used by the same target. This can also be used
however to determine the Qt major version, and therefore the
particular moc executable to use during automoc steps. This means
that targets in a single buildsystem can use a selection of Qt 4
and Qt 5, and still take advantage of the CMAKE_AUTOMOC feature
without conflicting.
Diffstat (limited to 'Tests/CMakeLists.txt')
-rw-r--r-- | Tests/CMakeLists.txt | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 0b221e8..230f776 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1044,6 +1044,20 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --test-command ${CMAKE_CTEST_COMMAND} -V ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Targets") + + if(Qt5Widgets_FOUND AND NOT Qt5Widgets_VERSION VERSION_LESS 5.1.0) + add_test(Qt4And5Automoc ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/Qt4And5Automoc" + "${CMake_BINARY_DIR}/Tests/Qt4And5Automoc" + ${build_generator_args} + --build-project Qt4And5Automoc + --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4And5Automoc" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4And5Automoc") + endif() endif() add_test(ExternalProject ${CMAKE_CTEST_COMMAND} |