From 795e7b44f28923db56801c455cfada023499fc80 Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Fri, 6 Sep 2024 15:48:38 +1000 Subject: Help: file(CONFIGURE) only updates output file timestamp if it changes --- Help/command/file.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Help/command/file.rst b/Help/command/file.rst index 5b9dfac..34e97e7 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -302,7 +302,9 @@ Writing variable values referenced as ``@VAR@`` or ``${VAR}`` contained therein. The substitution rules behave the same as the :command:`configure_file` command. In order to match :command:`configure_file`'s behavior, generator expressions - are not supported for both ``OUTPUT`` and ``CONTENT``. + are not supported for both ``OUTPUT`` and ``CONTENT``, and the output file + is only modified and its timestamp updated if the content is changed or the + file previously didn't exist. The arguments are: -- cgit v0.12 From cbb727ca6b394aed1852d47be052a73ed8450bee Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Fri, 6 Sep 2024 15:53:48 +1000 Subject: FetchContent: Don't update verify script timestamp if it doesn't change Fixes: #26255 --- Modules/ExternalProject/shared_internal_commands.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/ExternalProject/shared_internal_commands.cmake b/Modules/ExternalProject/shared_internal_commands.cmake index a709670..09b9764 100644 --- a/Modules/ExternalProject/shared_internal_commands.cmake +++ b/Modules/ExternalProject/shared_internal_commands.cmake @@ -1221,7 +1221,9 @@ hash=${hash} endif () set(comment "Performing download step (${steps}) for '${name}'") # 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 # more robust to just depend on the download script. That way, we will -- cgit v0.12