[VS2017] Enable building with v141 toolset
MODIFY
include/vcpkg_Environment.h
include/vcpkg_Environment.h
@@ -17,5 +17,11 @@ namespace vcpkg::Environment
const fs::path& get_dumpbin_exe(const vcpkg_paths& paths);
- const fs::path& get_vcvarsall_bat(const vcpkg_paths& paths);
+ struct vcvarsall_and_platform_toolset
+ {
+ fs::path path;
+ std::wstring platform_toolset;
+ };
+
+ const vcvarsall_and_platform_toolset& get_vcvarsall_bat(const vcpkg_paths& paths);
}

MODIFY
src/commands_build.cpp
src/commands_build.cpp
@@ -30,12 +30,13 @@ namespace vcpkg::Commands::Build
const triplet& target_triplet = spec.target_triplet();
const fs::path ports_cmake_script_path = paths.ports_cmake;
- const fs::path vcvarsall_bat = Environment::get_vcvarsall_bat(paths);
- const std::wstring command = Strings::wformat(LR"("%s" %s && cmake -DCMD=BUILD -DPORT=%s -DTARGET_TRIPLET=%s "-DCURRENT_PORT_DIR=%s/." -P "%s")",
- vcvarsall_bat.native(),
+ const Environment::vcvarsall_and_platform_toolset vcvarsall_bat = Environment::get_vcvarsall_bat(paths);
+ const std::wstring command = Strings::wformat(LR"("%s" %s && 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());

MODIFY
src/vcpkg_Environment.cpp
src/vcpkg_Environment.cpp
@@ -167,7 +167,7 @@ namespace vcpkg::Environment
return dumpbin_exe;
}
- static fs::path find_vcvarsall_bat(const vcpkg_paths& paths)
+ static vcvarsall_and_platform_toolset find_vcvarsall_bat(const vcpkg_paths& paths)
{
const std::vector<std::string> vs2017_installation_instances = get_VS2017_installation_instances(paths);
std::vector<fs::path> paths_examined;
@@ -179,7 +179,7 @@ namespace vcpkg::Environment
paths_examined.push_back(vcvarsall_bat);
if (fs::exists(vcvarsall_bat))
{
- return vcvarsall_bat;
+ return { vcvarsall_bat , L"v141"};
}
}
@@ -188,7 +188,7 @@ namespace vcpkg::Environment
paths_examined.push_back(vs2015_vcvarsall_bat);
if (fs::exists(vs2015_vcvarsall_bat))
{
- return vs2015_vcvarsall_bat;
+ return { vs2015_vcvarsall_bat, L"v140" };
}
System::println(System::color::error, "Could not detect vccarsall.bat.");
@@ -200,9 +200,9 @@ namespace vcpkg::Environment
exit(EXIT_FAILURE);
}
- const fs::path& get_vcvarsall_bat(const vcpkg_paths& paths)
+ const vcvarsall_and_platform_toolset& get_vcvarsall_bat(const vcpkg_paths& paths)
{
- static const fs::path vcvarsall_bat = find_vcvarsall_bat(paths);
+ static const vcvarsall_and_platform_toolset vcvarsall_bat = find_vcvarsall_bat(paths);
return vcvarsall_bat;
}
}

[VS2017] Enable building with v141 toolset