diff options
author | Craig Scott <craig.scott@crascit.com> | 2022-01-08 09:51:44 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2022-01-08 09:51:44 (GMT) |
commit | d73fc5dd2a54264b8437be89b849de99c8bd370b (patch) | |
tree | 560e3183034c606cca66ea10d1dcf1096930531d /Modules | |
parent | 3279cec0129805f003ff1371e5931f3ae122cfbe (diff) | |
download | CMake-d73fc5dd2a54264b8437be89b849de99c8bd370b.zip CMake-d73fc5dd2a54264b8437be89b849de99c8bd370b.tar.gz CMake-d73fc5dd2a54264b8437be89b849de99c8bd370b.tar.bz2 |
ExternalProject: Fix misuse of IS_NEWER_THAN in timestamp checks
This change was originally made in 404cddb7bb (ExternalProject:
Fix misuse of IS_NEWER_THAN in timestamp checks, 2021-02-21),
but was reverted by 57d442e182 (Revert ExternalProject and
FetchContent refactoring, 2021-03-10) due to regressions from
other changes. Reapply this fix on its own, since it is still valid.
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')
-rw-r--r-- | Modules/ExternalProject.cmake | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 4004ea4..fc15a0f 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1302,7 +1302,8 @@ function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git file(WRITE ${script_filename} " -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}\") message(STATUS \"Avoiding repeated git clone, stamp file is up to date: '${gitclone_stampfile}'\") return() endif() @@ -1378,7 +1379,8 @@ function(_ep_write_hgclone_script script_filename source_dir hg_EXECUTABLE hg_re endif() file(WRITE ${script_filename} " -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}\") message(STATUS \"Avoiding repeated hg clone, stamp file is up to date: '${hgclone_stampfile}'\") return() endif() |