diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 43fdb971e0ce9dbf75721dd8882b12cb82e2466c..ad584103110a25d14673990c8c3fe13fa591cecf 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -911,9 +911,11 @@ std::string cmGlobalVisualStudioVersionedGenerator::FindMSBuildCommand() windowsVersion.dwBuildNumber >= 22000)); if (isWindows11OrGreater) { msbuild = vs + "/MSBuild/Current/Bin/arm64/MSBuild.exe"; - if (cmSystemTools::FileExists(msbuild)) { - return msbuild; - } + } else { + msbuild = vs + "/MSBuild/Current/Bin/MSBuild.exe"; + } + if (cmSystemTools::FileExists(msbuild)) { + return msbuild; } #endif