From 84a423040686fb5855cbe65d4aa4e209dc4ca870 Mon Sep 17 00:00:00 2001 From: David Cole Date: Mon, 17 Mar 2014 07:32:35 -0400 Subject: [PATCH] Tests: Prevent unnecessary rebuilds in CTestTestMemcheck Repeated "cmake . && ninja" calls were resulting in rebuilds every time. Change the test so that it uses "file(WRITE" to generate a ".in" file and then configure_file to "copy if different" that ".in" file to the final generated source file. Now, rebuilds will only occur if there are changes to the generated source file on "cmake ." runs after the first one. --- Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt b/Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt index c5aa2cdbd..47d6a2488 100644 --- a/Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt @@ -1,7 +1,12 @@ # A dummy checker implementation that does not write the requested output file # so it triggers an error for every checker. -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ret0.c" "int main(){return 0;}\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ret0.c.in" "int main(){return 0;}\n") + +configure_file( + "${CMAKE_CURRENT_BINARY_DIR}/ret0.c.in" + "${CMAKE_CURRENT_BINARY_DIR}/ret0.c" + ) foreach(_pseudo IN ITEMS valgrind purify BC) add_executable(pseudonl_${_pseudo} "${CMAKE_CURRENT_BINARY_DIR}/ret0.c")