mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-15 03:48:02 +08:00
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
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user