Commit da402a08 authored by Brad King's avatar Brad King

VS: Use MSBuild matching toolset host architecture

VS 2017 and VS 2019 provide `amd64/MSBuild.exe` variants next to
their `MSBuild.exe` tools.  When the 64-bit host toolchain is
selected (e.g. via `host=x64`), select the 64-bit MSBuild too.

Fixes: #18219
parent 147d36ce
Pipeline #128866 passed with stage
......@@ -471,6 +471,18 @@ std::string cmGlobalVisualStudioVersionedGenerator::FindMSBuildCommand()
// Ask Visual Studio Installer tool.
std::string vs;
if (vsSetupAPIHelper.GetVSInstanceInfo(vs)) {
std::string const& hostArch =
this->GetPlatformToolsetHostArchitectureString();
if (hostArch == "x64") {
msbuild = vs + "/MSBuild/Current/Bin/amd64/MSBuild.exe";
if (cmSystemTools::FileExists(msbuild)) {
return msbuild;
}
msbuild = vs + "/MSBuild/15.0/Bin/amd64/MSBuild.exe";
if (cmSystemTools::FileExists(msbuild)) {
return msbuild;
}
}
msbuild = vs + "/MSBuild/Current/Bin/MSBuild.exe";
if (cmSystemTools::FileExists(msbuild)) {
return msbuild;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment