summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-06-01 17:36:13 (GMT)
committerBrad King <brad.king@kitware.com>2020-06-01 17:42:16 (GMT)
commit37bf7eb7a6440d7b2465a5e69fbf820217ac7eb3 (patch)
tree14a119a02da479b9c0479f4b9cee558d847918a2 /Tests/RunCMake
parent1d2c8ae209e4cc0121310b0da10063b68f43bc68 (diff)
downloadCMake-37bf7eb7a6440d7b2465a5e69fbf820217ac7eb3.zip
CMake-37bf7eb7a6440d7b2465a5e69fbf820217ac7eb3.tar.gz
CMake-37bf7eb7a6440d7b2465a5e69fbf820217ac7eb3.tar.bz2
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.
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake8
2 files changed, 7 insertions, 2 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 868eb24..65d5e44 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -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
)
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index bee9e5b..82c55cc 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -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)