[vcpkg_apply_patches] Work around /etc/gitconfig: Permission denied (#14848)

Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
This commit is contained in:
ras0219 2020-11-30 09:50:42 -08:00 committed by GitHub
parent 666589a27d
commit 7c08030982
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,6 +37,12 @@ function(vcpkg_apply_patches)
cmake_parse_arguments(PARSE_ARGV 0 _ap "QUIET" "SOURCE_PATH" "PATCHES")
find_program(GIT NAMES git git.cmd)
if(DEFINED ENV{GIT_CONFIG_NOSYSTEM})
set(GIT_CONFIG_NOSYSTEM_BACKUP "$ENV{GIT_CONFIG_NOSYSTEM}")
else()
unset(GIT_CONFIG_NOSYSTEM_BACKUP)
endif()
set(ENV{GIT_CONFIG_NOSYSTEM} 1)
set(PATCHNUM 0)
foreach(PATCH ${_ap_PATCHES})
get_filename_component(ABSOLUTE_PATCH "${PATCH}" ABSOLUTE BASE_DIR "${CURRENT_PORT_DIR}")
@ -57,4 +63,9 @@ function(vcpkg_apply_patches)
math(EXPR PATCHNUM "${PATCHNUM}+1")
endforeach()
if(DEFINED GIT_CONFIG_NOSYSTEM_BACKUP)
set(ENV{GIT_CONFIG_NOSYSTEM} "${GIT_CONFIG_NOSYSTEM_BACKUP}")
else()
unset(ENV{GIT_CONFIG_NOSYSTEM})
endif()
endfunction()