diff options
Diffstat (limited to 'Tests/RunCMake/File_Generate')
-rw-r--r-- | Tests/RunCMake/File_Generate/ReRunCMake-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/File_Generate/ReRunCMake.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/File_Generate/RunCMakeTest.cmake | 31 |
4 files changed, 38 insertions, 0 deletions
diff --git a/Tests/RunCMake/File_Generate/ReRunCMake-result.txt b/Tests/RunCMake/File_Generate/ReRunCMake-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/File_Generate/ReRunCMake-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt b/Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/File_Generate/ReRunCMake.cmake b/Tests/RunCMake/File_Generate/ReRunCMake.cmake new file mode 100644 index 0000000..109d60e --- /dev/null +++ b/Tests/RunCMake/File_Generate/ReRunCMake.cmake @@ -0,0 +1,5 @@ + +file(GENERATE + OUTPUT output_file.txt + INPUT "${CMAKE_CURRENT_BINARY_DIR}/input_file.txt" +) diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index 7db77d4..97f93d5 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -61,3 +61,34 @@ if (UNIX AND EXISTS /bin/sh) message(SEND_ERROR "Generated script did not execute correctly:\n${script_output}\n====\n${script_error}") endif() endif() + +if (RunCMake_GENERATOR MATCHES Makefiles) + file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/ReRunCMake-build/") + file(WRITE "${RunCMake_BINARY_DIR}/ReRunCMake-build/input_file.txt" "InitialContent\n") + + set(RunCMake_TEST_NO_CLEAN ON) + run_cmake(ReRunCMake) + unset(RunCMake_TEST_NO_CLEAN) + file(TIMESTAMP "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt" timestamp ${timeformat}) + if(NOT timestamp) + message(SEND_ERROR "Could not get timestamp for \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"") + endif() + + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) + + file(WRITE "${RunCMake_BINARY_DIR}/ReRunCMake-build/input_file.txt" "ChangedContent\n") + execute_process(COMMAND ${CMAKE_COMMAND} --build "${RunCMake_BINARY_DIR}/ReRunCMake-build/") + file(READ "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt" out_content) + + if(NOT out_content STREQUAL "ChangedContent\n") + message(SEND_ERROR "File did not change: \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"") + endif() + + + file(REMOVE "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt") + execute_process(COMMAND ${CMAKE_COMMAND} --build "${RunCMake_BINARY_DIR}/ReRunCMake-build/") + + if (NOT EXISTS "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt") + message(SEND_ERROR "File did not re-generate: \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"") + endif() +endif() |