[vcpkg_configure_make] Prevent leakage of CC env variable from debug to release configuration (#48807)

This commit is contained in:
Thomas1664 2025-12-13 09:11:38 +01:00 committed by GitHub
parent 84bab45d41
commit cfcbdb245f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 2 deletions

View File

@ -374,7 +374,7 @@ function(vcpkg_configure_make)
find_program(base_cmd bash REQUIRED)
endif()
# Apple platforms - cross-compiling support
# Apple platforms - cross-compiling support
if(VCPKG_TARGET_IS_APPLE)
if (requires_autoconfig AND NOT arg_BUILD_TRIPLET OR arg_DETERMINE_BUILD_TRIPLET)
z_vcpkg_determine_autotools_host_arch_mac(BUILD_ARCH) # machine you are building on => --build=
@ -830,7 +830,8 @@ function(vcpkg_configure_make)
set(ENV{ARFLAGS} "${ARFLAGS_${current_buildtype}}")
endif()
if(VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_IOS)
set(env_cc_backup "$ENV{CC}")
if(VCPKG_TARGET_IS_APPLE)
# configure not using all flags to check if compiler works ...
set(ENV{CC} "$ENV{CC} $ENV{CPPFLAGS} $ENV{CFLAGS}")
set(ENV{CC_FOR_BUILD} "$ENV{CC_FOR_BUILD} $ENV{CPPFLAGS} $ENV{CFLAGS}")
@ -888,6 +889,9 @@ function(vcpkg_configure_make)
set(ENV{PATH} "${path_backup}")
endif()
# Restore environment (config dependent)
if(VCPKG_TARGET_IS_APPLE)
set(ENV{CC} "${env_cc_backup}")
endif()
foreach(ENV_VAR IN LISTS ${arg_CONFIG_DEPENDENT_ENVIRONMENT})
if(backup_config_${ENV_VAR})
set(ENV{${ENV_VAR}} "${backup_config_${ENV_VAR}}")