summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/ExternalProject.cmake47
1 files changed, 28 insertions, 19 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index db3716a..c69a2ee 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1239,7 +1239,7 @@ endif()
endfunction()
-function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_remote_name init_submodules git_submodules git_repository work_dir)
+function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_remote_name init_submodules git_submodules_recurse git_submodules git_repository work_dir)
if("${git_tag}" STREQUAL "")
message(FATAL_ERROR "Tag for git checkout should not be empty.")
endif()
@@ -2339,6 +2339,29 @@ function(_ep_is_dir_empty dir empty_var)
endif()
endfunction()
+function(_ep_get_git_submodules_recurse git_submodules_recurse)
+ # Checks for GIT_SUBMODULES_RECURSE property
+ # Default is ON, which sets git_submodules_recurse output variable to "--recursive"
+ # Otherwise, the output variable is set to an empty value ""
+ get_property(git_submodules_recurse_set TARGET ${name} PROPERTY _EP_GIT_SUBMODULES_RECURSE SET)
+ if(NOT git_submodules_recurse_set)
+ set(recurseFlag "--recursive")
+ else()
+ get_property(git_submodules_recurse_value TARGET ${name} PROPERTY _EP_GIT_SUBMODULES_RECURSE)
+ if(git_submodules_recurse_value)
+ set(recurseFlag "--recursive")
+ else()
+ set(recurseFlag "")
+ endif()
+ endif()
+ set(${git_submodules_recurse} "${recurseFlag}" PARENT_SCOPE)
+
+ # The git submodule update '--recursive' flag requires git >= v1.6.5
+ if(recurseFlag AND GIT_VERSION_STRING VERSION_LESS 1.6.5)
+ message(FATAL_ERROR "error: git version 1.6.5 or later required for --recursive flag with 'git submodule ...': GIT_VERSION_STRING='${GIT_VERSION_STRING}'")
+ endif()
+endfunction()
+
function(_ep_add_download_command name)
ExternalProject_Get_Property(${name} source_dir stamp_dir download_dir tmp_dir)
@@ -2431,23 +2454,7 @@ function(_ep_add_download_command name)
message(FATAL_ERROR "error: could not find git for clone of ${name}")
endif()
- get_property(git_submodules_recurse_set TARGET ${name} PROPERTY _EP_GIT_SUBMODULES_RECURSE SET)
- if(NOT git_submodules_recurse_set)
- set(git_submodules_recurse "--recursive")
- else()
- get_property(git_submodules_recurse_value TARGET ${name} PROPERTY _EP_GIT_SUBMODULES_RECURSE)
- if(git_submodules_recurse_value)
- set(git_submodules_recurse "--recursive")
- else()
- set(git_submodules_recurse "")
- endif()
- endif()
-
- # The git submodule update '--recursive' flag requires git >= v1.6.5
- #
- if(git_submodules_recurse AND GIT_VERSION_STRING VERSION_LESS 1.6.5)
- message(FATAL_ERROR "error: git version 1.6.5 or later required for 'git submodule update --recursive': GIT_VERSION_STRING='${GIT_VERSION_STRING}'")
- endif()
+ _ep_get_git_submodules_recurse(git_submodules_recurse)
get_property(git_tag TARGET ${name} PROPERTY _EP_GIT_TAG)
if(NOT git_tag)
@@ -2774,8 +2781,10 @@ function(_ep_add_update_command name)
endif()
endif()
+ _ep_get_git_submodules_recurse(git_submodules_recurse)
+
_ep_write_gitupdate_script(${tmp_dir}/${name}-gitupdate.cmake
- ${GIT_EXECUTABLE} ${git_tag} ${git_remote_name} ${git_init_submodules} "${git_submodules}" ${git_repository} ${work_dir}
+ ${GIT_EXECUTABLE} ${git_tag} ${git_remote_name} ${git_init_submodules} "${git_submodules_recurse}" "${git_submodules}" ${git_repository} ${work_dir}
)
set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitupdate.cmake)
set(always 1)