Specify GIT only when VCPKG_FORCE_SYSTEM_BINARIES is set
MODIFY
src/vcpkg/build.cpp
src/vcpkg/build.cpp
@@ -362,10 +362,8 @@ namespace vcpkg::Build
}
const Toolset& toolset = paths.get_toolset(pre_build_info);
- const std::string cmd_launch_cmake = System::make_cmake_cmd(
- cmake_exe_path,
- paths.ports_cmake,
- {
+
+ std::vector<System::CMakeVariable> variables {
{"CMD", "BUILD"},
{"PORT", config.scf.core_paragraph->name},
{"CURRENT_PORT_DIR", config.port_dir},
@@ -376,10 +374,19 @@ namespace vcpkg::Build
{"DOWNLOADS", paths.downloads},
{"_VCPKG_NO_DOWNLOADS", !Util::Enum::to_bool(config.build_package_options.allow_downloads) ? "1" : "0"},
{"_VCPKG_DOWNLOAD_TOOL", to_string(config.build_package_options.download_tool)},
- {"GIT", git_exe_path},
{"FEATURES", Strings::join(";", config.feature_list)},
{"ALL_FEATURES", all_features},
- });
+ };
+
+ if (!System::get_environment_variable("VCPKG_FORCE_SYSTEM_BINARIES").has_value())
+ {
+ variables.push_back({"GIT", git_exe_path});
+ }
+
+ const std::string cmd_launch_cmake = System::make_cmake_cmd(
+ cmake_exe_path,
+ paths.ports_cmake,
+ variables);
auto command = make_build_env_cmd(pre_build_info, toolset);
if (!command.empty())

Specify GIT only when VCPKG_FORCE_SYSTEM_BINARIES is set (#6143)