1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-15 20:46:37 +08:00

Tests: Skip RunCMake.try_compile RerunCMake-nowork case on 1s filesystems

On low-resolution filesystems, `Makefile` can end up with the same
time stamp as `CMakeCache.txt`.  CMake must re-run in this case to
be conservative, but that invalidates the `-nowork` cases.

Rather than trying to detect 1s filesystems, just add an option
called `CMake_TEST_FILESYSTEM_1S` that external scripts can use
to tell CMake's test suite about this.
This commit is contained in:
Brad King
2020-06-01 13:36:13 -04:00
parent 1d2c8ae209
commit 37bf7eb7a6
2 changed files with 7 additions and 2 deletions

View File

@@ -356,6 +356,7 @@ function(add_RunCMake_test_try_compile)
CMAKE_CXX_COMPILER_VERSION
CMAKE_CXX_STANDARD_DEFAULT
CMake_TEST_CUDA
CMake_TEST_FILESYSTEM_1S
CMAKE_OBJC_STANDARD_DEFAULT
CMAKE_OBJCXX_STANDARD_DEFAULT
)

View File

@@ -83,13 +83,17 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja")
message(STATUS "RerunCMake: first configuration...")
run_cmake(RerunCMake)
run_cmake_command(RerunCMake-nowork${ninja} ${CMAKE_COMMAND} --build .)
if(NOT CMake_TEST_FILESYSTEM_1S)
run_cmake_command(RerunCMake-nowork${ninja} ${CMAKE_COMMAND} --build .)
endif()
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) # handle 1s resolution
message(STATUS "RerunCMake: modify try_compile input...")
file(WRITE "${in_tc}" "does-not-compile\n")
run_cmake_command(RerunCMake-rerun${ninja} ${CMAKE_COMMAND} --build .)
run_cmake_command(RerunCMake-nowork${ninja} ${CMAKE_COMMAND} --build .)
if(NOT CMake_TEST_FILESYSTEM_1S)
run_cmake_command(RerunCMake-nowork${ninja} ${CMAKE_COMMAND} --build .)
endif()
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)