summaryrefslogtreecommitdiffstats
path: root/Modules/ExternalProject
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2021-02-21 06:40:21 (GMT)
committerBrad King <brad.king@kitware.com>2021-02-22 16:02:20 (GMT)
commit404cddb7bbb0e05bba2f3023f0ee2fa302c35124 (patch)
tree5b8d4697fcd6982687dc3965cc63ffc0dfbd608e /Modules/ExternalProject
parenteefcf2e0a6ed07fd288314d91eaa4a96d9da6ec8 (diff)
downloadCMake-404cddb7bbb0e05bba2f3023f0ee2fa302c35124.zip
CMake-404cddb7bbb0e05bba2f3023f0ee2fa302c35124.tar.gz
CMake-404cddb7bbb0e05bba2f3023f0ee2fa302c35124.tar.bz2
ExternalProject: Fix misuse of IS_NEWER_THAN in timestamp checks
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 downloads when they match exactly.
Diffstat (limited to 'Modules/ExternalProject')
-rw-r--r--Modules/ExternalProject/gitclone.cmake.in3
-rw-r--r--Modules/ExternalProject/hgclone.cmake.in3
2 files changed, 4 insertions, 2 deletions
diff --git a/Modules/ExternalProject/gitclone.cmake.in b/Modules/ExternalProject/gitclone.cmake.in
index a2e900c..edbdd72 100644
--- a/Modules/ExternalProject/gitclone.cmake.in
+++ b/Modules/ExternalProject/gitclone.cmake.in
@@ -7,7 +7,8 @@ set(quiet "@quiet@")
set(script_dir "@CMAKE_CURRENT_FUNCTION_LIST_DIR@/ExternalProject")
include(${script_dir}/captured_process_setup.cmake)
-if(NOT "@gitclone_infofile@" IS_NEWER_THAN "@gitclone_stampfile@")
+if(EXISTS "@gitclone_stampfile@" AND EXISTS "@gitclone_infofile@" AND
+ "@gitclone_stampfile@" IS_NEWER_THAN "@gitclone_infofile@")
if(NOT quiet)
message(STATUS
"Avoiding repeated git clone, stamp file is up to date: "
diff --git a/Modules/ExternalProject/hgclone.cmake.in b/Modules/ExternalProject/hgclone.cmake.in
index 5561955..9a574d2 100644
--- a/Modules/ExternalProject/hgclone.cmake.in
+++ b/Modules/ExternalProject/hgclone.cmake.in
@@ -7,7 +7,8 @@ set(quiet "@quiet@")
set(script_dir "@CMAKE_CURRENT_FUNCTION_LIST_DIR@/ExternalProject")
include(${script_dir}/captured_process_setup.cmake)
-if(NOT "@hgclone_infofile@" IS_NEWER_THAN "@hgclone_stampfile@")
+if(EXISTS "@hgclone_stampfile@" AND EXISTS "@hgclone_infofile@" AND
+ "@hgclone_stampfile@" IS_NEWER_THAN "@hgclone_infofile@")
if(NOT quiet)
message(STATUS
"Avoiding repeated hg clone, stamp file is up to date: "