mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-19 19:43:23 +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:
@@ -356,6 +356,7 @@ function(add_RunCMake_test_try_compile)
|
|||||||
CMAKE_CXX_COMPILER_VERSION
|
CMAKE_CXX_COMPILER_VERSION
|
||||||
CMAKE_CXX_STANDARD_DEFAULT
|
CMAKE_CXX_STANDARD_DEFAULT
|
||||||
CMake_TEST_CUDA
|
CMake_TEST_CUDA
|
||||||
|
CMake_TEST_FILESYSTEM_1S
|
||||||
CMAKE_OBJC_STANDARD_DEFAULT
|
CMAKE_OBJC_STANDARD_DEFAULT
|
||||||
CMAKE_OBJCXX_STANDARD_DEFAULT
|
CMAKE_OBJCXX_STANDARD_DEFAULT
|
||||||
)
|
)
|
||||||
|
@@ -83,13 +83,17 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja")
|
|||||||
|
|
||||||
message(STATUS "RerunCMake: first configuration...")
|
message(STATUS "RerunCMake: first configuration...")
|
||||||
run_cmake(RerunCMake)
|
run_cmake(RerunCMake)
|
||||||
|
if(NOT CMake_TEST_FILESYSTEM_1S)
|
||||||
run_cmake_command(RerunCMake-nowork${ninja} ${CMAKE_COMMAND} --build .)
|
run_cmake_command(RerunCMake-nowork${ninja} ${CMAKE_COMMAND} --build .)
|
||||||
|
endif()
|
||||||
|
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) # handle 1s resolution
|
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) # handle 1s resolution
|
||||||
message(STATUS "RerunCMake: modify try_compile input...")
|
message(STATUS "RerunCMake: modify try_compile input...")
|
||||||
file(WRITE "${in_tc}" "does-not-compile\n")
|
file(WRITE "${in_tc}" "does-not-compile\n")
|
||||||
run_cmake_command(RerunCMake-rerun${ninja} ${CMAKE_COMMAND} --build .)
|
run_cmake_command(RerunCMake-rerun${ninja} ${CMAKE_COMMAND} --build .)
|
||||||
|
if(NOT CMake_TEST_FILESYSTEM_1S)
|
||||||
run_cmake_command(RerunCMake-nowork${ninja} ${CMAKE_COMMAND} --build .)
|
run_cmake_command(RerunCMake-nowork${ninja} ${CMAKE_COMMAND} --build .)
|
||||||
|
endif()
|
||||||
|
|
||||||
unset(RunCMake_TEST_BINARY_DIR)
|
unset(RunCMake_TEST_BINARY_DIR)
|
||||||
unset(RunCMake_TEST_NO_CLEAN)
|
unset(RunCMake_TEST_NO_CLEAN)
|
||||||
|
Reference in New Issue
Block a user