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.
This commit is contained in:
David Cole 2014-03-17 07:32:35 -04:00 committed by Brad King
parent 6313be44aa
commit 84a4230406
1 changed files with 6 additions and 1 deletions

View File

@ -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")