summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalVisualStudioVersionedGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-01-28 18:33:32 (GMT)
committerBrad King <brad.king@kitware.com>2019-01-29 14:11:00 (GMT)
commitda402a081b6575b4813e5e8798105317b451ac1e (patch)
tree230066ffb63f1bd2d542ac4d483374fc04e4395e /Source/cmGlobalVisualStudioVersionedGenerator.cxx
parent147d36ce93d563df4ce1899facbb256e6bc9bbb2 (diff)
downloadCMake-da402a081b6575b4813e5e8798105317b451ac1e.zip
CMake-da402a081b6575b4813e5e8798105317b451ac1e.tar.gz
CMake-da402a081b6575b4813e5e8798105317b451ac1e.tar.bz2
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
Diffstat (limited to 'Source/cmGlobalVisualStudioVersionedGenerator.cxx')
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index bc6b453..12d9304 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -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;