mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 10:21:07 +08:00
Allow additional environment variables to be set in a clean environment (#5650)
* Allow additional environment variables to be set in a clean environment * Add documentation for VCPKG_KEEP_ENV_VARS
This commit is contained in:
parent
78a8de6cf4
commit
d71ad4800b
@ -40,3 +40,10 @@ This environment variable can be set to a triplet name which will be used for un
|
||||
#### VCPKG_FORCE_SYSTEM_BINARIES
|
||||
|
||||
This environment variable, if set, suppresses the downloading of CMake and Ninja and forces the use of the system binaries.
|
||||
|
||||
### VCPKG_KEEP_ENV_VARS
|
||||
|
||||
This environment variable can be set to a list of environment variables, separated by `;`, which will be propagated to
|
||||
the build environment.
|
||||
|
||||
Example: `FOO_SDK_DIR;BAR_SDK_DIR`
|
||||
|
@ -178,6 +178,19 @@ namespace vcpkg::System
|
||||
L"ANDROID_NDK_HOME",
|
||||
};
|
||||
|
||||
const Optional<std::string> keep_vars = System::get_environment_variable("VCPKG_KEEP_ENV_VARS");
|
||||
const auto k = keep_vars.get();
|
||||
|
||||
if (k && !k->empty())
|
||||
{
|
||||
auto vars = Strings::split(*k, ";");
|
||||
|
||||
for (auto&& var : vars)
|
||||
{
|
||||
env_wstrings.push_back(Strings::to_utf16(var.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring env_cstr;
|
||||
|
||||
for (auto&& env_wstring : env_wstrings)
|
||||
|
Loading…
x
Reference in New Issue
Block a user