summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2024-07-26 01:23:58 (GMT)
committerCraig Scott <craig.scott@crascit.com>2024-07-26 01:23:58 (GMT)
commit5df592ce31cbcf278e9742552f36ba2a9a46c3b7 (patch)
tree4eaeb93c2986b55860a5a0d5fd3748da1d7953e4
parentc233c51cb96468458eb5f5540f468d489954da2e (diff)
downloadCMake-5df592ce31cbcf278e9742552f36ba2a9a46c3b7.zip
CMake-5df592ce31cbcf278e9742552f36ba2a9a46c3b7.tar.gz
CMake-5df592ce31cbcf278e9742552f36ba2a9a46c3b7.tar.bz2
FetchContent: Ensure can_fetch_default is set early enough
The can_fetch_default variable needs to be set before the call to _ep_write_gitupdate_script(). Move it to before that call and always set the variable, even if arg_SCRIPT_FILE is not set. This makes the generated git update script file easier to follow if someone tries to follow what it is doing or wants to investigate problems and run it manually. Fixes: #26164
-rw-r--r--Modules/ExternalProject/shared_internal_commands.cmake11
1 files changed, 6 insertions, 5 deletions
diff --git a/Modules/ExternalProject/shared_internal_commands.cmake b/Modules/ExternalProject/shared_internal_commands.cmake
index ef0c6d9..a709670 100644
--- a/Modules/ExternalProject/shared_internal_commands.cmake
+++ b/Modules/ExternalProject/shared_internal_commands.cmake
@@ -1535,6 +1535,12 @@ function(_ep_add_update_command name)
set(comment "Performing update step for '${name}'")
set(comment_disconnected "Performing disconnected update step for '${name}'")
+ if(update_disconnected)
+ set(can_fetch_default NO)
+ else()
+ set(can_fetch_default YES)
+ endif()
+
set(git_tag "${_EP_GIT_TAG}")
if(NOT git_tag)
set(git_tag "master")
@@ -1602,11 +1608,6 @@ function(_ep_add_update_command name)
set(always 1)
if(arg_SCRIPT_FILE)
- if(update_disconnected)
- set(can_fetch_default NO)
- else()
- set(can_fetch_default YES)
- endif()
set(step_script_contents "include(\"${update_script}\")")
endif()