summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-09-18 13:56:32 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-09-18 13:56:32 (GMT)
commit0d5605120bd88c40878ef8248f47889ea2321e6d (patch)
tree0812d219997715f2e38f0293b6cc65f2a3df9c29 /Modules
parent9c7bb9f1039aaafa19f5e5b68b6336f148c20f0a (diff)
parent7c5b6ed5c851266b4f6dae5ef864509627acdaf8 (diff)
downloadCMake-0d5605120bd88c40878ef8248f47889ea2321e6d.zip
CMake-0d5605120bd88c40878ef8248f47889ea2321e6d.tar.gz
CMake-0d5605120bd88c40878ef8248f47889ea2321e6d.tar.bz2
Merge topic 'ExternalProject_stash_save_all'
7c5b6ed5 ExternalProject: Use "git stash save --all" only if supported (#15722) b04c3815 ExternalProject: Use GIT_VERSION_STRING instead of custom method
Diffstat (limited to 'Modules')
-rw-r--r--Modules/ExternalProject.cmake24
1 files changed, 7 insertions, 17 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 0fbf7c3..90ceedf 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -646,6 +646,11 @@ endfunction()
function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_submodules git_repository work_dir)
+ if(NOT GIT_VERSION_STRING VERSION_LESS 1.7.6)
+ set(git_stash_save_options --all --quiet)
+ else()
+ set(git_stash_save_options --quiet)
+ endif()
file(WRITE ${script_filename}
"if(\"${git_tag}\" STREQUAL \"\")
message(FATAL_ERROR \"Tag for git checkout should not be empty.\")
@@ -724,7 +729,7 @@ if(error_code OR is_remote_ref OR NOT (\"\${tag_sha}\" STREQUAL \"\${head_sha}\"
# perform git pull --rebase
if(need_stash)
execute_process(
- COMMAND \"${git_EXECUTABLE}\" stash save --all --quiet
+ COMMAND \"${git_EXECUTABLE}\" stash save ${git_stash_save_options}
WORKING_DIRECTORY \"${work_dir}\"
RESULT_VARIABLE error_code
)
@@ -1631,20 +1636,6 @@ function(_ep_add_mkdir_command name)
endfunction()
-function(_ep_get_git_version git_EXECUTABLE git_version_var)
- if(git_EXECUTABLE)
- execute_process(
- COMMAND "${git_EXECUTABLE}" --version
- OUTPUT_VARIABLE ov
- ERROR_VARIABLE ev
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
- string(REGEX REPLACE "^git version (.+)$" "\\1" version "${ov}")
- set(${git_version_var} "${version}" PARENT_SCOPE)
- endif()
-endfunction()
-
-
function(_ep_is_dir_empty dir empty_var)
file(GLOB gr "${dir}/*")
if("${gr}" STREQUAL "")
@@ -1747,8 +1738,7 @@ function(_ep_add_download_command name)
# The git submodule update '--recursive' flag requires git >= v1.6.5
#
- _ep_get_git_version("${GIT_EXECUTABLE}" git_version)
- if(git_version VERSION_LESS 1.6.5)
+ if(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='${git_version}'")
endif()