mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-07 14:50:15 -05:00
VS: Fix SLNs for DOTNET_SDK targets with VS_GLOBAL_PlatformTarget
By default, .NET SDK-style projects build for "Any CPU", so we generate solution files accordingly. Although CMake does not model per-target architectures, some projects set the `VS_GLOBAL_PlatformTarget` property on `DOTNET_SDK` targets in order to compile for a specific architecture. Fix generated solution files to account for the architecture override. Issue: #23513
This commit is contained in:
@@ -977,12 +977,19 @@ cm::VS::Solution cmGlobalVisualStudioGenerator::CreateSolution(
|
||||
project->TypeId = Solution::Project::TypeIdDefault;
|
||||
}
|
||||
|
||||
project->Platform =
|
||||
// On VS 19 and above, always map .NET SDK projects to "Any CPU".
|
||||
(gt->IsDotNetSdkTarget() && this->Version >= VSVersion::VS16 &&
|
||||
!cmGlobalVisualStudioGenerator::IsReservedTarget(gt->GetName()))
|
||||
? "Any CPU"
|
||||
: solution.Platform;
|
||||
if (gt->IsDotNetSdkTarget() &&
|
||||
!cmGlobalVisualStudioGenerator::IsReservedTarget(gt->GetName())) {
|
||||
cmValue platformTarget = gt->GetProperty("VS_GLOBAL_PlatformTarget");
|
||||
if (!platformTarget.IsEmpty()) {
|
||||
project->Platform = *platformTarget;
|
||||
} else {
|
||||
project->Platform =
|
||||
// On VS 16 and above, always map .NET SDK projects to "Any CPU".
|
||||
this->Version >= VSVersion::VS16 ? "Any CPU" : solution.Platform;
|
||||
}
|
||||
} else {
|
||||
project->Platform = solution.Platform;
|
||||
}
|
||||
|
||||
// Add solution-level dependencies.
|
||||
TargetDependSet const& depends = this->GetTargetDirectDepends(gt);
|
||||
|
||||
Reference in New Issue
Block a user