diff options
author | Brad King <brad.king@kitware.com> | 2021-06-24 20:25:42 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-06-25 16:45:53 (GMT) |
commit | 93c718791e4e81f37dcc3413b3e847d94313d5c9 (patch) | |
tree | 9722dcab1375ac1faace4d0b779d6c5d320d9d4e /Source/cmGlobalVisualStudioVersionedGenerator.cxx | |
parent | c46b265839c408ba04edc6ae7c96bc257547f43c (diff) | |
download | CMake-93c718791e4e81f37dcc3413b3e847d94313d5c9.zip CMake-93c718791e4e81f37dcc3413b3e847d94313d5c9.tar.gz CMake-93c718791e4e81f37dcc3413b3e847d94313d5c9.tar.bz2 |
VS: Use 64-bit MSBuild in VS 2022
Visual Studio 17 2022 is now a 64-bit native application. It places the
64-bit `MSBuild.exe` in the `PATH` of VS command prompts, so prefer it
for this version and above.
This was previously attempted for older VS versions, but reverted by
commit f3cedf381e (VS: Revert "Use MSBuild matching toolset host
architecture", 2019-03-12, v3.14.0~1^2). For now, do not use the 64-bit
MSBuild for VS 16 and below.
Fixes: #18219
Diffstat (limited to 'Source/cmGlobalVisualStudioVersionedGenerator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudioVersionedGenerator.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index a2b5258..aafc9d5 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -716,6 +716,12 @@ std::string cmGlobalVisualStudioVersionedGenerator::FindMSBuildCommand() // Ask Visual Studio Installer tool. std::string vs; if (vsSetupAPIHelper.GetVSInstanceInfo(vs)) { + if (this->Version >= cmGlobalVisualStudioGenerator::VS17) { + msbuild = vs + "/MSBuild/Current/Bin/amd64/MSBuild.exe"; + if (cmSystemTools::FileExists(msbuild)) { + return msbuild; + } + } msbuild = vs + "/MSBuild/Current/Bin/MSBuild.exe"; if (cmSystemTools::FileExists(msbuild)) { return msbuild; |