summaryrefslogtreecommitdiffstats
path: root/Tests/QtAutogen/CMakeLists.txt
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2017-03-02 16:26:11 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2017-03-06 21:01:03 (GMT)
commitd9a7ef80aaff4373baf4c864c97efbbf20337dea (patch)
treea1de360c1c49173d893bdfa6e957608486baa1e8 /Tests/QtAutogen/CMakeLists.txt
parent89780663b3f64eddf7dda2b5565935b73d92c146 (diff)
downloadCMake-d9a7ef80aaff4373baf4c864c97efbbf20337dea.zip
CMake-d9a7ef80aaff4373baf4c864c97efbbf20337dea.tar.gz
CMake-d9a7ef80aaff4373baf4c864c97efbbf20337dea.tar.bz2
Autogen: Test: Add timestamp comparison to moc rerun test
Diffstat (limited to 'Tests/QtAutogen/CMakeLists.txt')
-rw-r--r--Tests/QtAutogen/CMakeLists.txt43
1 files changed, 29 insertions, 14 deletions
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index bf40166..c941d8c 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -95,25 +95,27 @@ if (NOT RCC_DEPENDS)
message(SEND_ERROR "Initial build of rccDepends failed. Output: ${output}")
endif()
-file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/rccDepends/info_file.txt" qrc_files)
-
-list(GET qrc_files 0 qrc_file1)
-
+# Get name and timestamp of the output binary
+file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/rccDepends/target1.txt" target1List)
+list(GET target1List 0 binFile)
set(timeformat "%Y%j%H%M%S")
+file(TIMESTAMP "${binFile}" timeBegin "${timeformat}")
-file(TIMESTAMP "${qrc_file1}" file1_before "${timeformat}")
-
+# Touch qrc input file and rebuild
execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_BINARY_DIR}/rccDepends/res1/input.txt")
-
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/rccDepends"
+ RESULT_VARIABLE rccDepends_result
)
+if (rccDepends_result)
+ message(SEND_ERROR "Second build of rccDepends failed.")
+endif()
-file(TIMESTAMP "${qrc_file1}" file1_step1 "${timeformat}")
-
-if (NOT file1_step1 GREATER file1_before)
- message(SEND_ERROR "file1 (${qrc_file1}) should have changed in the first step!")
+# Compare timestamps
+file(TIMESTAMP "${binFile}" timeStep1 "${timeformat}")
+if (NOT timeStep1 GREATER timeBegin)
+ message(SEND_ERROR "file1 (${binFile}) should have changed in the first step!")
endif()
# -- Test
@@ -131,16 +133,29 @@ if (NOT MOC_RERUN)
message(SEND_ERROR "Initial build of mocRerun failed. Output: ${output}")
endif()
-configure_file(mocRerun/test1b.h.in mocRerun/test1.h COPYONLY)
+# Get name and timestamp of the output binary
+file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/mocRerun/target1.txt" target1List)
+list(GET target1List 0 binFile)
+set(timeformat "%Y%j%H%M%S")
+file(TIMESTAMP "${binFile}" timeBegin "${timeformat}")
+# Change file content and rebuild
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+configure_file(mocRerun/test1b.h.in mocRerun/test1.h COPYONLY)
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mocRerun"
- RESULT_VARIABLE automoc_rerun_result
+ RESULT_VARIABLE mocRerun_result
)
-if (automoc_rerun_result)
+if (mocRerun_result)
message(SEND_ERROR "Second build of mocRerun failed.")
endif()
+# Compare timestamps
+file(TIMESTAMP "${binFile}" timeStep1 "${timeformat}")
+if (NOT timeStep1 GREATER timeBegin)
+ message(SEND_ERROR "File (${binFile}) should have changed in the first step!")
+endif()
+
# -- Test
# Test for SKIP_AUTOMOC and SKIP_AUTOGEN on an AUTOMOC enabled target
qtx_wrap_cpp(skipMocWrapMoc