summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-05-30 21:23:42 (GMT)
committerBrad King <brad.king@kitware.com>2023-05-30 21:44:43 (GMT)
commitda27ff1e963b11dd91060fddb9e47a3135b4ac6c (patch)
treee82cf3edfcf507fbd0cb2a97a3bfdce6b7b0a60a /Tests
parente0b48284a1beaef7f5a49073c8d4684418476ae1 (diff)
downloadCMake-da27ff1e963b11dd91060fddb9e47a3135b4ac6c.zip
CMake-da27ff1e963b11dd91060fddb9e47a3135b4ac6c.tar.gz
CMake-da27ff1e963b11dd91060fddb9e47a3135b4ac6c.tar.bz2
Preserve --compile-no-warning-as-error in automatic CMake re-runs
When the build system re-runs `cmake` to regenerate itself, preserve the `--compile-no-warning-as-error` option if it was used when `cmake` was last explicitly invoked. Normally such settings are preserved in the cache, but the purpose of this option is to be beyond the reach of project code.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CompileWarningAsError/RunCMakeTest.cmake4
1 files changed, 4 insertions, 0 deletions
diff --git a/Tests/RunCMake/CompileWarningAsError/RunCMakeTest.cmake b/Tests/RunCMake/CompileWarningAsError/RunCMakeTest.cmake
index 392c921..18df14c 100644
--- a/Tests/RunCMake/CompileWarningAsError/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CompileWarningAsError/RunCMakeTest.cmake
@@ -5,6 +5,10 @@ function(run_compile_warn test lang extension)
set(RunCMake_TEST_OUTPUT_MERGE 1)
run_cmake_with_options(${test}_${lang} "-DLANGUAGE=${lang}" "-DEXTENSION=${extension}" ${ARGN})
set(RunCMake_TEST_NO_CLEAN 1)
+ if(ARGN MATCHES "--compile-no-warning-as-error")
+ # Cause the build system to re-run CMake to verify that this option is preserved.
+ run_cmake_command(${test}_${lang}-Touch ${CMAKE_COMMAND} -E touch_nocreate CMakeCache.txt)
+ endif()
run_cmake_command(${test}_${lang}-Build ${CMAKE_COMMAND} --build . ${verbose_args})
endfunction()