Browse Source

cmake --build: Remove unused code for VS .NET SDK style projects

In commit 5cdd774d51 (VS: Handle build target correct for .NET SDK style
projects with Any CPU, 2022-02-02, v3.23.0-rc1~3^2), some `.sln` parse
results were stored in temporaries and never used by `cmake --build`.
Fixing that locally breaks `--target SomeDotNetSdkProject` in `x64`:

    $ cmake --build . --config Debug --target SomeDotNetSdkProject --verbose
    ".../MSBuild.exe" SomeDotNetSdkProject.csproj ... "/p:Platform=Any CPU"
    error MSB8013: This project doesn't contain ... Debug|Win32

Pending further investigation, remove the partial implementation that
amounts to a no-op.
Brad King 3 months ago
parent
commit
2edc497261
1 changed files with 2 additions and 14 deletions
  1. 2 14
      Source/cmGlobalVisualStudio10Generator.cxx

+ 2 - 14
Source/cmGlobalVisualStudio10Generator.cxx

@@ -1123,17 +1123,16 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand(
     GeneratedMakeCommand makeCommand;
     makeCommand.RequiresOutputForward = requiresOutputForward;
     makeCommand.Add(makeProgramSelected);
-    cm::optional<cmSlnProjectEntry> proj = cm::nullopt;
 
     if (tname == "clean"_s) {
       makeCommand.Add(cmStrCat(projectName, ".sln"));
       makeCommand.Add("/t:Clean");
     } else {
       std::string targetProject = cmStrCat(tname, ".vcxproj");
-      proj = slnData.GetProjectByName(tname);
       if (targetProject.find('/') == std::string::npos) {
         // it might be in a subdir
-        if (proj) {
+        if (cm::optional<cmSlnProjectEntry> proj =
+              slnData.GetProjectByName(tname)) {
           targetProject = proj->GetRelativePath();
           cmSystemTools::ConvertToUnixSlashes(targetProject);
         }
@@ -1205,17 +1204,6 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand(
     }
 
     std::string platform = GetPlatformName();
-    if (proj) {
-      std::string extension =
-        cmSystemTools::GetFilenameLastExtension(proj->GetRelativePath());
-      extension = cmSystemTools::LowerCase(extension);
-      if (extension == ".csproj"_s) {
-        // Use correct platform name
-        platform =
-          slnData.GetConfigurationTarget(tname, plainConfig, platform);
-      }
-    }
-
     makeCommand.Add(cmStrCat("/p:Configuration=", plainConfig));
     makeCommand.Add(cmStrCat("/p:Platform=", platform));
     makeCommand.Add(