浏览代码

FetchContent: Don't update verify script timestamp if it doesn't change

Fixes: #26255
Craig Scott 1 年之前
父节点
当前提交
cbb727ca6b
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      Modules/ExternalProject/shared_internal_commands.cmake

+ 3 - 1
Modules/ExternalProject/shared_internal_commands.cmake

@@ -1221,7 +1221,9 @@ hash=${hash}
         endif ()
         endif ()
         set(comment "Performing download step (${steps}) for '${name}'")
         set(comment "Performing download step (${steps}) for '${name}'")
         # already verified by 'download_script'
         # already verified by 'download_script'
-        file(WRITE "${verify_script}" "")
+        # We use file(CONFIGURE) instead of file(WRITE) to avoid updating the
+        # timestamp when the file already existed and was empty.
+        file(CONFIGURE OUTPUT "${verify_script}" CONTENT "")
 
 
         # Rather than adding everything to the RepositoryInfo.txt file, it is
         # Rather than adding everything to the RepositoryInfo.txt file, it is
         # more robust to just depend on the download script. That way, we will
         # more robust to just depend on the download script. That way, we will