message: `build`: Use make_cmake_cmd() and paths.get_cmake/git_exe()
diff: @@ -39,22 +39,26 @@ namespace vcpkg::Commands::Build
  }
  }
  - // If these environment variables are set while running the VS2017 developer prompt, it will not correctly initialize the build environment.
  - System::set_environmental_variable(L"VSINSTALLDIR", L"");
  - System::set_environmental_variable(L"DevEnvDir", L"");
  + const fs::path& cmake_exe_path = paths.get_cmake_exe();
  + const fs::path& git_exe_path = paths.get_git_exe();
  const fs::path ports_cmake_script_path = paths.ports_cmake;
  const Environment::vcvarsall_and_platform_toolset vcvarsall_bat = Environment::get_vcvarsall_bat(paths);
  - const std::wstring command = Strings::wformat(LR"("%s" %s >nul 2>&1 && cmake -DCMD=BUILD -DPORT=%s -DTARGET_TRIPLET=%s -DVCPKG_PLATFORM_TOOLSET=%s "-DCURRENT_PORT_DIR=%s/." -P "%s")",
  - vcvarsall_bat.path.native(),
  - Strings::utf8_to_utf16(target_triplet.architecture()),
  - Strings::utf8_to_utf16(source_paragraph.name),
  - Strings::utf8_to_utf16(target_triplet.canonical_name()),
  - vcvarsall_bat.platform_toolset,
  - port_dir.generic_wstring(),
  - ports_cmake_script_path.generic_wstring());
  + const std::wstring cmd_set_environment = Strings::wformat(LR"("%s" %s >nul 2>&1)", vcvarsall_bat.path.native(), Strings::utf8_to_utf16(target_triplet.architecture()));
  - ElapsedTime timer = ElapsedTime::createStarted();
  + const std::wstring cmd_launch_cmake = make_cmake_cmd(cmake_exe_path, ports_cmake_script_path,
  + {
  + { L"CMD", L"BUILD" },
  + { L"PORT", source_paragraph.name },
  + { L"CURRENT_PORT_DIR", port_dir / "/." },
  + { L"TARGET_TRIPLET", target_triplet.canonical_name() },
  + { L"VCPKG_PLATFORM_TOOLSET", vcvarsall_bat.platform_toolset },
  + { L"GIT", git_exe_path }
  + });
  +
  + const std::wstring command = Strings::wformat(LR"(%s && %s)", cmd_set_environment, cmd_launch_cmake);
  +
  + const ElapsedTime timer = ElapsedTime::createStarted();
  int return_code = System::cmd_execute(command);
  auto buildtimeus = timer.microseconds();
  @@ -133,7 +137,6 @@ namespace vcpkg::Commands::Build
  Checks::check_exit(!maybe_spgh.error_code(), "Could not find package named %s: %s", spec, maybe_spgh.error_code().message());
  const SourceParagraph& spgh = *maybe_spgh.get();
  - Environment::ensure_utilities_on_path(paths);
  StatusParagraphs status_db = database_load_check(paths);
  const BuildResult result = build_package(spgh, spec, paths, paths.port_dir(spec), status_db);
  if (result == BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES)
  