mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-16 20:21:41 -06:00
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
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user