From 6ebf21a360e4574eacbdf4f475f7d5a3f7b53cb4 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 29 Oct 2025 11:51:59 -0400 Subject: [PATCH] VS: Restore support for Intel Fortran projects Refactoring in commit 3882718872 (VS: Decouple solution generation from `.sln` file format, 2025-09-15, v4.2.0-rc1~154^2~3) accidentally dropped Fortran targets from the generated VS Solution. Fixes: #27346 --- Source/cmGlobalVisualStudioGenerator.cxx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 9c765d038d..ea9dde256f 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -988,9 +988,7 @@ cm::VS::Solution cmGlobalVisualStudioGenerator::CreateSolution( continue; } - cmValue vcprojName = gt->GetProperty("GENERATOR_FILE_NAME"); - cmValue vcprojType = gt->GetProperty("GENERATOR_FILE_NAME_EXT"); - if (vcprojName && vcprojType) { + if (cmValue vcprojName = gt->GetProperty("GENERATOR_FILE_NAME")) { cmLocalGenerator* lg = gt->GetLocalGenerator(); std::string dir = root->MaybeRelativeToCurBinDir(lg->GetCurrentBinaryDirectory()); @@ -1000,14 +998,21 @@ cm::VS::Solution cmGlobalVisualStudioGenerator::CreateSolution( dir += "/"; } - project->Path = cmStrCat(dir, *vcprojName, *vcprojType); + cm::string_view vcprojExt; if (this->TargetIsFortranOnly(gt)) { + vcprojExt = ".vfproj"_s; project->TypeId = Solution::Project::TypeIdFortran; } else if (gt->IsCSharpOnly()) { + vcprojExt = ".csproj"_s; project->TypeId = Solution::Project::TypeIdCSharp; } else { + vcprojExt = ".vcproj"_s; project->TypeId = Solution::Project::TypeIdDefault; } + if (cmValue genExt = gt->GetProperty("GENERATOR_FILE_NAME_EXT")) { + vcprojExt = *genExt; + } + project->Path = cmStrCat(dir, *vcprojName, vcprojExt); if (gt->IsDotNetSdkTarget() && !cmGlobalVisualStudioGenerator::IsReservedTarget(gt->GetName())) {