Browse Source

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
Brad King 1 month ago
parent
commit
6ebf21a360
1 changed files with 9 additions and 4 deletions
  1. 9 4
      Source/cmGlobalVisualStudioGenerator.cxx

+ 9 - 4
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())) {