diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2017-12-09 12:30:54 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2017-12-13 12:50:18 (GMT) |
commit | b1504f9f97849777f4690565f8b5879372e7dd51 (patch) | |
tree | 320510b9093aa093e4e16a7544a99b943a1d32a0 /Tests | |
parent | e9fcd1545facf6300181db843260008e1069c7b4 (diff) | |
download | CMake-b1504f9f97849777f4690565f8b5879372e7dd51.zip CMake-b1504f9f97849777f4690565f8b5879372e7dd51.tar.gz CMake-b1504f9f97849777f4690565f8b5879372e7dd51.tar.bz2 |
Autogen: Tests: Separate RerunRccDepends test
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 30 | ||||
-rw-r--r-- | Tests/QtAutogen/CommonTests.cmake | 1 | ||||
-rw-r--r-- | Tests/QtAutogen/RerunRccDepends/CMakeLists.txt (renamed from Tests/QtAutogenRerun/rccDepends.cmake) | 20 | ||||
-rw-r--r-- | Tests/QtAutogen/RerunRccDepends/RccDepends/CMakeLists.txt (renamed from Tests/QtAutogenRerun/rccDepends/CMakeLists.txt) | 32 | ||||
-rw-r--r-- | Tests/QtAutogen/RerunRccDepends/RccDepends/main.cpp (renamed from Tests/QtAutogenRerun/rccDepends/main.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/input.txt.in (renamed from Tests/QtAutogenRerun/rccDepends/resGen/input.txt.in) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/inputAdded.txt.in (renamed from Tests/QtAutogenRerun/rccDepends/resGen/inputAdded.txt.in) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/RerunRccDepends/RccDepends/resGenA.qrc.in (renamed from Tests/QtAutogenRerun/rccDepends/resGenA.qrc.in) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/RerunRccDepends/RccDepends/resGenB.qrc.in (renamed from Tests/QtAutogenRerun/rccDepends/resGenB.qrc.in) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/input.txt.in (renamed from Tests/QtAutogenRerun/rccDepends/resPlain/input.txt.in) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/inputAdded.txt.in (renamed from Tests/QtAutogenRerun/rccDepends/resPlain/inputAdded.txt.in) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainA.qrc.in (renamed from Tests/QtAutogenRerun/rccDepends/resPlainA.qrc.in) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainB.qrc.in (renamed from Tests/QtAutogenRerun/rccDepends/resPlainB.qrc.in) | 0 | ||||
-rw-r--r-- | Tests/QtAutogen/RerunRccDepends/dummy.cpp (renamed from Tests/QtAutogenRerun/dummy.cpp) | 0 | ||||
-rw-r--r-- | Tests/QtAutogenRerun/CMakeLists.txt | 43 | ||||
-rw-r--r-- | Tests/QtAutogenRerun/defines_test/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/QtAutogenRerun/defines_test/defines_test.cpp | 38 |
17 files changed, 27 insertions, 141 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index b0bf887..46dc224 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1263,21 +1263,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if(CMake_TEST_Qt5 AND Qt5Widgets_FOUND) add_subdirectory(Qt5Autogen) - add_test(NAME Qt5AutogenRerun COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/QtAutogenRerun" - "${CMake_BINARY_DIR}/Tests/Qt5AutogenRerun" - ${build_generator_args} - --build-project QtAutogenRerun - --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt5AutogenRerun" - --force-new-ctest-process - --build-options ${build_options} - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} - -DQT_TEST_VERSION=5 - ${QtAutogen_BUILD_OPTIONS} - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5AutogenRerun") - add_test(Qt5AutoUicInterface ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/QtAutoUicInterface" @@ -1295,21 +1280,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if(QT4_WORKS AND QT_QTGUI_FOUND) add_subdirectory(Qt4Autogen) - add_test(NAME Qt4AutogenRerun COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/QtAutogenRerun" - "${CMake_BINARY_DIR}/Tests/Qt4AutogenRerun" - ${build_generator_args} - --build-project QtAutogenRerun - --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4AutogenRerun" - --force-new-ctest-process - --build-options ${build_options} - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} - -DQT_TEST_VERSION=4 - ${QtAutogen_BUILD_OPTIONS} - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4AutogenRerun") - add_test(Qt4AutoUicInterface ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/QtAutoUicInterface" diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index b03c282..5746ab5 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -36,3 +36,4 @@ ADD_AUTOGEN_TEST(RerunMocBasic) if(NOT QT_TEST_VERSION STREQUAL 4) ADD_AUTOGEN_TEST(RerunMocPlugin) endif() +ADD_AUTOGEN_TEST(RerunRccDepends) diff --git a/Tests/QtAutogenRerun/rccDepends.cmake b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt index 68e1482..2e6a5bd 100644 --- a/Tests/QtAutogenRerun/rccDepends.cmake +++ b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt @@ -1,8 +1,17 @@ +cmake_minimum_required(VERSION 3.10) +project(RerunRccDepends) +include("../AutogenTest.cmake") + +# Tests rcc rebuilding when a resource file changes + +# Dummy executable to generate a clean target +add_executable(dummy dummy.cpp) + # When a .qrc or a file listed in a .qrc file changes, # the target must be rebuilt set(timeformat "%Y%j%H%M%S") -set(rccDepSD "${CMAKE_CURRENT_SOURCE_DIR}/rccDepends") -set(rccDepBD "${CMAKE_CURRENT_BINARY_DIR}/rccDepends") +set(rccDepSD "${CMAKE_CURRENT_SOURCE_DIR}/RccDepends") +set(rccDepBD "${CMAKE_CURRENT_BINARY_DIR}/RccDepends") # Initial build configure_file(${rccDepSD}/resPlainA.qrc.in ${rccDepBD}/resPlain.qrc COPYONLY) @@ -10,10 +19,9 @@ configure_file(${rccDepSD}/resGenA.qrc.in ${rccDepBD}/resGen.qrc.in COPYONLY) try_compile(RCC_DEPENDS "${rccDepBD}" "${rccDepSD}" - rccDepends - CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" - "-DQT_TEST_VERSION=${QT_TEST_VERSION}" - "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}" + RccDepends + CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" OUTPUT_VARIABLE output ) if (NOT RCC_DEPENDS) diff --git a/Tests/QtAutogenRerun/rccDepends/CMakeLists.txt b/Tests/QtAutogen/RerunRccDepends/RccDepends/CMakeLists.txt index 291592e..0507e61 100644 --- a/Tests/QtAutogenRerun/rccDepends/CMakeLists.txt +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/CMakeLists.txt @@ -1,17 +1,6 @@ -cmake_minimum_required(VERSION 3.9) -project(rccDepends CXX) - -if (QT_TEST_VERSION STREQUAL 4) - find_package(Qt4 REQUIRED) - set(QT_CORE_TARGET Qt4::QtCore) -else() - if (NOT QT_TEST_VERSION STREQUAL 5) - message(SEND_ERROR "Invalid Qt version specified.") - endif() - - find_package(Qt5Core REQUIRED) - set(QT_CORE_TARGET Qt5::Core) -endif() +cmake_minimum_required(VERSION 3.10) +project(RccDepends) +include("../../AutogenTest.cmake") # Enable AUTORCC for all targets set(CMAKE_AUTORCC ON) @@ -23,19 +12,22 @@ configure_file(resGen/input.txt.in resGen/input.txt COPYONLY) configure_file(resGen/input.txt.in resGen/inputAdded.txt COPYONLY) # Generated qrc file with dependency -add_custom_command(OUTPUT resGen.qrc +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc.in COMMAND ${CMAKE_COMMAND} -E sleep 2 - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc +) # Target that uses a plain .qrc file add_executable(rccDependsPlain main.cpp ${CMAKE_CURRENT_BINARY_DIR}/resPlain.qrc) -target_link_libraries(rccDependsPlain ${QT_CORE_TARGET}) +target_link_libraries(rccDependsPlain ${QT_QTCORE_TARGET}) add_custom_command(TARGET rccDependsPlain POST_BUILD COMMAND - ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDependsPlain>" > targetPlain.txt) + ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDependsPlain>" > targetPlain.txt +) # Target that uses a GENERATED .qrc file add_executable(rccDependsGen main.cpp ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc ) -target_link_libraries(rccDependsGen ${QT_CORE_TARGET}) +target_link_libraries(rccDependsGen ${QT_QTCORE_TARGET}) add_custom_command(TARGET rccDependsGen POST_BUILD COMMAND - ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDependsGen>" > targetGen.txt) + ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDependsGen>" > targetGen.txt +) diff --git a/Tests/QtAutogenRerun/rccDepends/main.cpp b/Tests/QtAutogen/RerunRccDepends/RccDepends/main.cpp index 766b775..766b775 100644 --- a/Tests/QtAutogenRerun/rccDepends/main.cpp +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/main.cpp diff --git a/Tests/QtAutogenRerun/rccDepends/resGen/input.txt.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/input.txt.in index 4f24589..4f24589 100644 --- a/Tests/QtAutogenRerun/rccDepends/resGen/input.txt.in +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/input.txt.in diff --git a/Tests/QtAutogenRerun/rccDepends/resGen/inputAdded.txt.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/inputAdded.txt.in index 4f24589..4f24589 100644 --- a/Tests/QtAutogenRerun/rccDepends/resGen/inputAdded.txt.in +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/inputAdded.txt.in diff --git a/Tests/QtAutogenRerun/rccDepends/resGenA.qrc.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGenA.qrc.in index c131a34..c131a34 100644 --- a/Tests/QtAutogenRerun/rccDepends/resGenA.qrc.in +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGenA.qrc.in diff --git a/Tests/QtAutogenRerun/rccDepends/resGenB.qrc.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGenB.qrc.in index 8c7e643..8c7e643 100644 --- a/Tests/QtAutogenRerun/rccDepends/resGenB.qrc.in +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGenB.qrc.in diff --git a/Tests/QtAutogenRerun/rccDepends/resPlain/input.txt.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/input.txt.in index a5e407a..a5e407a 100644 --- a/Tests/QtAutogenRerun/rccDepends/resPlain/input.txt.in +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/input.txt.in diff --git a/Tests/QtAutogenRerun/rccDepends/resPlain/inputAdded.txt.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/inputAdded.txt.in index a5e407a..a5e407a 100644 --- a/Tests/QtAutogenRerun/rccDepends/resPlain/inputAdded.txt.in +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/inputAdded.txt.in diff --git a/Tests/QtAutogenRerun/rccDepends/resPlainA.qrc.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainA.qrc.in index c135d85..c135d85 100644 --- a/Tests/QtAutogenRerun/rccDepends/resPlainA.qrc.in +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainA.qrc.in diff --git a/Tests/QtAutogenRerun/rccDepends/resPlainB.qrc.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainB.qrc.in index 186b653..186b653 100644 --- a/Tests/QtAutogenRerun/rccDepends/resPlainB.qrc.in +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainB.qrc.in diff --git a/Tests/QtAutogenRerun/dummy.cpp b/Tests/QtAutogen/RerunRccDepends/dummy.cpp index 4837a76..4837a76 100644 --- a/Tests/QtAutogenRerun/dummy.cpp +++ b/Tests/QtAutogen/RerunRccDepends/dummy.cpp diff --git a/Tests/QtAutogenRerun/CMakeLists.txt b/Tests/QtAutogenRerun/CMakeLists.txt deleted file mode 100644 index 9f1ee28..0000000 --- a/Tests/QtAutogenRerun/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -cmake_minimum_required(VERSION 3.9) -cmake_policy(SET CMP0071 NEW) -project(QtAutogenRerun) - -# Tell find_package(Qt5) where to find Qt. -if(QT_QMAKE_EXECUTABLE) - get_filename_component(Qt_BIN_DIR "${QT_QMAKE_EXECUTABLE}" PATH) - get_filename_component(Qt_PREFIX_DIR "${Qt_BIN_DIR}" PATH) - list(APPEND CMAKE_PREFIX_PATH ${Qt_PREFIX_DIR}) -endif() - -if (QT_TEST_VERSION STREQUAL 4) - find_package(Qt4 REQUIRED) - - # Include this directory before using the UseQt4 file. - add_subdirectory(defines_test) - - include(UseQt4) - - set(QT_QTCORE_TARGET Qt4::QtCore) - -else() - if (NOT QT_TEST_VERSION STREQUAL 5) - message(SEND_ERROR "Invalid Qt version specified.") - endif() - find_package(Qt5Widgets REQUIRED) - - set(QT_QTCORE_TARGET Qt5::Core) - - include_directories(${Qt5Widgets_INCLUDE_DIRS}) - set(QT_LIBRARIES Qt5::Widgets) - - if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC) - add_definitions(${CMAKE_CXX_COMPILE_OPTIONS_PIC}) - endif() - -endif() - -# Dummy executable to generate clean target -add_executable(dummy dummy.cpp) - -# -- Test -include("rccDepends.cmake") diff --git a/Tests/QtAutogenRerun/defines_test/CMakeLists.txt b/Tests/QtAutogenRerun/defines_test/CMakeLists.txt deleted file mode 100644 index 9ee9a22..0000000 --- a/Tests/QtAutogenRerun/defines_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ - -add_executable(defines_test defines_test.cpp) -set_target_properties(defines_test PROPERTIES AUTOMOC TRUE) -target_link_libraries(defines_test Qt4::QtGui) diff --git a/Tests/QtAutogenRerun/defines_test/defines_test.cpp b/Tests/QtAutogenRerun/defines_test/defines_test.cpp deleted file mode 100644 index cf4e9cb..0000000 --- a/Tests/QtAutogenRerun/defines_test/defines_test.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -#include <QObject> - -#ifdef QT_GUI_LIB -#include <QTextDocument> - -class SomeDocument : public QTextDocument -{ - Q_OBJECT - -Q_SIGNALS: - void someSig(); -}; -#endif - -#ifdef QT_CORE_LIB -class SomeObject : public QObject -{ - Q_OBJECT - -Q_SIGNALS: - void someSig(); -}; -#endif - -int main(int argc, char** argv) -{ -#ifdef QT_CORE_LIB - QMetaObject sosmo = SomeObject::staticMetaObject; -#endif -#ifdef QT_GUI_LIB - QMetaObject sdsmo = SomeDocument::staticMetaObject; -#endif - - return 0; -} - -#include "defines_test.moc" |