diff options
author | Craig Scott <craig.scott@crascit.com> | 2021-02-21 06:46:38 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-02-22 16:02:38 (GMT) |
commit | 8c93e3232f0db066ce613317db940a631f7d0d5e (patch) | |
tree | 5c65bcb800d3931c15d4ceddd8dec26fd0e0f75e /Modules/GoogleTest.cmake | |
parent | 28501fca94f5bb54807f82ec5eb4e1885d6c7b11 (diff) | |
download | CMake-8c93e3232f0db066ce613317db940a631f7d0d5e.zip CMake-8c93e3232f0db066ce613317db940a631f7d0d5e.tar.gz CMake-8c93e3232f0db066ce613317db940a631f7d0d5e.tar.bz2 |
GoogleTest: Fix misuse of IS_NEWER_THAN in timestamp check
When using a file system which only has second resolution timestamps,
there is a reasonably high likelihood of timestamps being the same.
The IS_NEWER_THAN test returns true when timestamps are the same,
so don't redo test discovery when they match exactly.
Diffstat (limited to 'Modules/GoogleTest.cmake')
-rw-r--r-- | Modules/GoogleTest.cmake | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake index 2ea9e74..80d8e23 100644 --- a/Modules/GoogleTest.cmake +++ b/Modules/GoogleTest.cmake @@ -504,7 +504,8 @@ function(gtest_discover_tests TARGET) string(CONCAT ctest_include_content "if(EXISTS \"$<TARGET_FILE:${TARGET}>\")" "\n" - " if(\"$<TARGET_FILE:${TARGET}>\" IS_NEWER_THAN \"${ctest_tests_file}\")" "\n" + " if(NOT EXISTS \"${ctest_tests_file}\" OR" "\n" + " NOT \"${ctest_tests_file}\" IS_NEWER_THAN \"$<TARGET_FILE:${TARGET}>\")" "\n" " include(\"${_GOOGLETEST_DISCOVER_TESTS_SCRIPT}\")" "\n" " gtest_discover_tests_impl(" "\n" " TEST_EXECUTABLE" " [==[" "$<TARGET_FILE:${TARGET}>" "]==]" "\n" |