mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-13 18:00:09 -06:00
Users or scripts commonly remove or replace `CMakeCache.txt` without also removing `CMakeFiles/`. In this case the information saved in the cache from platform information initialization is missing, so we need to re-initialize it. In such a case, remove the platform information directory so that re-initialization will occur and restore needed information to the cache. Closes: #14820
36 lines
1.4 KiB
CMake
36 lines
1.4 KiB
CMake
include(RunCMake)
|
|
|
|
run_cmake(ContinueAfterError)
|
|
run_cmake(CustomTargetAfterError)
|
|
run_cmake(ErrorLogs)
|
|
run_cmake(FailCopyFileABI)
|
|
|
|
# Use a single build tree for a few tests without cleaning.
|
|
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/RerunCMake-build)
|
|
set(RunCMake_TEST_NO_CLEAN 1)
|
|
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
|
|
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
|
|
set(input "${RunCMake_TEST_BINARY_DIR}/CustomCMakeInput.txt")
|
|
set(stamp "${RunCMake_TEST_BINARY_DIR}/CustomCMakeStamp.txt")
|
|
set(depend "${RunCMake_TEST_BINARY_DIR}/CustomCMakeDepend.txt")
|
|
set(output "${RunCMake_TEST_BINARY_DIR}/CustomCMakeOutput.txt")
|
|
file(WRITE "${input}" "1")
|
|
file(WRITE "${depend}" "1")
|
|
run_cmake(RerunCMake)
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) # handle 1s resolution
|
|
file(WRITE "${input}" "2")
|
|
run_cmake_command(RerunCMake-build1 ${CMAKE_COMMAND} --build .)
|
|
file(WRITE "${depend}" "2")
|
|
run_cmake_command(RerunCMake-build2 ${CMAKE_COMMAND} --build .)
|
|
unset(RunCMake_TEST_BINARY_DIR)
|
|
unset(RunCMake_TEST_NO_CLEAN)
|
|
|
|
# Use a single build tree for a few tests without cleaning.
|
|
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/RemoveCache-build)
|
|
set(RunCMake_TEST_NO_CLEAN 1)
|
|
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
|
|
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
|
|
run_cmake(RemoveCache)
|
|
file(REMOVE "${RunCMake_TEST_BINARY_DIR}/CMakeCache.txt")
|
|
run_cmake(RemoveCache)
|