diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2017-09-05 12:00:49 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2017-09-21 07:58:24 (GMT) |
commit | 04a0daeeed5d57a545d0a8a450b51a009913808e (patch) | |
tree | 59415fcc6388619f985e3742b09f1d73d36b4733 /Tests/QtAutogenRerun/rccDepends.cmake | |
parent | e5c6610aba66b0a792f5fedb83e73a43460c3248 (diff) | |
download | CMake-04a0daeeed5d57a545d0a8a450b51a009913808e.zip CMake-04a0daeeed5d57a545d0a8a450b51a009913808e.tar.gz CMake-04a0daeeed5d57a545d0a8a450b51a009913808e.tar.bz2 |
Autogen: Tests: Move each rerun test script to a NAME.cmake file
Diffstat (limited to 'Tests/QtAutogenRerun/rccDepends.cmake')
-rw-r--r-- | Tests/QtAutogenRerun/rccDepends.cmake | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/Tests/QtAutogenRerun/rccDepends.cmake b/Tests/QtAutogenRerun/rccDepends.cmake new file mode 100644 index 0000000..e4cd282 --- /dev/null +++ b/Tests/QtAutogenRerun/rccDepends.cmake @@ -0,0 +1,91 @@ +# When a file listed in a .qrc file changes the target must be rebuilt +set(timeformat "%Y%j%H%M%S") +set(rccDependsSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/rccDepends") +set(rccDependsBinDir "${CMAKE_CURRENT_BINARY_DIR}/rccDepends") + +# Initial build +configure_file(${rccDependsSrcDir}/res1a.qrc.in ${rccDependsBinDir}/res1.qrc COPYONLY) +configure_file(${rccDependsSrcDir}/res2a.qrc.in ${rccDependsBinDir}/res2.qrc.in COPYONLY) +try_compile(RCC_DEPENDS + "${rccDependsBinDir}" + "${rccDependsSrcDir}" + rccDepends + CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" + "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}" + OUTPUT_VARIABLE output +) +if (NOT RCC_DEPENDS) + message(SEND_ERROR "Initial build of rccDepends failed. Output: ${output}") +endif() +# Get name of the output binary +file(STRINGS "${rccDependsBinDir}/target.txt" targetList ENCODING UTF-8) +list(GET targetList 0 rccDependsBin) + +file(TIMESTAMP "${rccDependsBin}" timeBegin "${timeformat}") +# Sleep, touch regular qrc input file, rebuild and compare timestamp +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change. +execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDependsBinDir}/res1/input.txt") +execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDependsBinDir}" RESULT_VARIABLE result) +if (result) + message(SEND_ERROR "Second build of rccDepends failed.") +endif() +file(TIMESTAMP "${rccDependsBin}" timeStep1 "${timeformat}") +if (NOT timeStep1 GREATER timeBegin) + message(SEND_ERROR "File (${rccDependsBin}) should have changed in the first step!") +endif() +# Sleep, update regular qrc file, rebuild and compare timestamp +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change. +configure_file(${rccDependsSrcDir}/res1b.qrc.in ${rccDependsBinDir}/res1.qrc COPYONLY) +execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDependsBinDir}" RESULT_VARIABLE result) +if (result) + message(SEND_ERROR "Third build of rccDepends failed.") +endif() +file(TIMESTAMP "${rccDependsBin}" timeStep2 "${timeformat}") +if (NOT timeStep2 GREATER timeStep1) + message(SEND_ERROR "File (${rccDependsBin}) should have changed in the second step!") +endif() +# Sleep, touch regular qrc newly added input file, rebuild and compare timestamp +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change. +execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDependsBinDir}/res1/inputAdded.txt") +execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDependsBinDir}" RESULT_VARIABLE result) +if (result) + message(SEND_ERROR "Fourth build of rccDepends failed.") +endif() +file(TIMESTAMP "${rccDependsBin}" timeStep3 "${timeformat}") +if (NOT timeStep3 GREATER timeStep2) + message(SEND_ERROR "File (${rccDependsBin}) should have changed in the third step!") +endif() +# Sleep, touch generated qrc input file, rebuild and compare timestamp +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change. +execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDependsBinDir}/res2/input.txt") +execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDependsBinDir}" RESULT_VARIABLE result) +if (result) + message(SEND_ERROR "Fifth build of rccDepends failed.") +endif() +file(TIMESTAMP "${rccDependsBin}" timeStep4 "${timeformat}") +if (NOT timeStep4 GREATER timeStep3) + message(SEND_ERROR "File (${rccDependsBin}) should have changed in the fourth step!") +endif() +# Sleep, update generated qrc file, rebuild and compare timestamp +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change. +configure_file(${rccDependsSrcDir}/res2b.qrc.in ${rccDependsBinDir}/res2.qrc.in COPYONLY) +execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDependsBinDir}" RESULT_VARIABLE result) +if (result) + message(SEND_ERROR "Sixth build of rccDepends failed.") +endif() +file(TIMESTAMP "${rccDependsBin}" timeStep5 "${timeformat}") +if (NOT timeStep5 GREATER timeStep4) + message(SEND_ERROR "File (${rccDependsBin}) should have changed in the fitfh step!") +endif() +# Sleep, touch generated qrc newly added input file, rebuild and compare timestamp +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change. +execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDependsBinDir}/res2/inputAdded.txt") +execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDependsBinDir}" RESULT_VARIABLE result) +if (result) + message(SEND_ERROR "Seventh build of rccDepends failed.") +endif() +file(TIMESTAMP "${rccDependsBin}" timeStep6 "${timeformat}") +if (NOT timeStep6 GREATER timeStep5) + message(SEND_ERROR "File (${rccDependsBin}) should have changed in the sixth step!") +endif() |