diff options
author | Brad King <brad.king@kitware.com> | 2021-01-21 14:26:53 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-01-21 14:27:04 (GMT) |
commit | c69567e56a3b4ba4eb6e02112b95c0143894d598 (patch) | |
tree | cad9faf9029e5d9f18165b1fa1353783622ecca2 /Modules/ExternalProject.cmake | |
parent | 8cdb9de586745f4935b30f6687a131a91234d646 (diff) | |
parent | 76fdeb6d13c4cfdaac8e933a9ef94c8e9def54ef (diff) | |
download | CMake-c69567e56a3b4ba4eb6e02112b95c0143894d598.zip CMake-c69567e56a3b4ba4eb6e02112b95c0143894d598.tar.gz CMake-c69567e56a3b4ba4eb6e02112b95c0143894d598.tar.bz2 |
Merge topic 'FindGit-cache-version'
76fdeb6d13 Tests: FindGit already provides the git version, re-use it
315a200f0c FindGit: Cache the GIT_EXECUTABLE version for the current run
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5712
Diffstat (limited to 'Modules/ExternalProject.cmake')
-rw-r--r-- | Modules/ExternalProject.cmake | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index bb3684a..29cfba9 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -2633,10 +2633,13 @@ function(_ep_add_download_command name) --non-interactive ${svn_trust_cert_args} ${svn_user_pw_args} ${src_name}) list(APPEND depends ${stamp_dir}/${name}-svninfo.txt) elseif(git_repository) - unset(CMAKE_MODULE_PATH) # Use CMake builtin find module - find_package(Git QUIET) - if(NOT GIT_EXECUTABLE) - message(FATAL_ERROR "error: could not find git for clone of ${name}") + # FetchContent gives us these directly, so don't try to recompute them + if(NOT GIT_EXECUTABLE OR NOT GIT_VERSION_STRING) + unset(CMAKE_MODULE_PATH) # Use CMake builtin find module + find_package(Git QUIET) + if(NOT GIT_EXECUTABLE) + message(FATAL_ERROR "error: could not find git for clone of ${name}") + endif() endif() _ep_get_git_submodules_recurse(git_submodules_recurse) @@ -2954,10 +2957,13 @@ function(_ep_add_update_command name) --non-interactive ${svn_trust_cert_args} ${svn_user_pw_args}) set(always 1) elseif(git_repository) - unset(CMAKE_MODULE_PATH) # Use CMake builtin find module - find_package(Git QUIET) - if(NOT GIT_EXECUTABLE) - message(FATAL_ERROR "error: could not find git for fetch of ${name}") + # FetchContent gives us these directly, so don't try to recompute them + if(NOT GIT_EXECUTABLE OR NOT GIT_VERSION_STRING) + unset(CMAKE_MODULE_PATH) # Use CMake builtin find module + find_package(Git QUIET) + if(NOT GIT_EXECUTABLE) + message(FATAL_ERROR "error: could not find git for fetch of ${name}") + endif() endif() set(work_dir ${source_dir}) set(comment "Performing update step for '${name}'") |