mirror of
https://github.com/reactos/CMake.git
synced 2024-12-11 21:34:32 +00:00
Autogen: Test: Add timestamp comparison to moc rerun test
This commit is contained in:
parent
89780663b3
commit
d9a7ef80aa
@ -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
|
||||
|
@ -25,3 +25,5 @@ add_executable(test1
|
||||
)
|
||||
target_include_directories(test1 PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
target_link_libraries(test1 ${QT_CORE_TARGET})
|
||||
add_custom_command(TARGET test1 POST_BUILD COMMAND
|
||||
${CMAKE_COMMAND} -E echo "$<TARGET_FILE:test1>" > target1.txt)
|
||||
|
@ -24,4 +24,4 @@ add_executable(test_res1
|
||||
)
|
||||
target_link_libraries(test_res1 ${QT_CORE_TARGET})
|
||||
add_custom_command(TARGET test_res1 POST_BUILD COMMAND
|
||||
${CMAKE_COMMAND} -E echo "$<TARGET_FILE:test_res1>" > info_file.txt)
|
||||
${CMAKE_COMMAND} -E echo "$<TARGET_FILE:test_res1>" > target1.txt)
|
||||
|
Loading…
Reference in New Issue
Block a user