Przeglądaj źródła

VS: Fix SLNX with multiple solution-to-project configuration mappings

Filter each mapping to apply only to its intended solution-wide config.

Fixes: #27385
Brad King 1 miesiąc temu
rodzic
commit
7c284f4278

+ 1 - 0
Source/cmVSSolution.cxx

@@ -319,6 +319,7 @@ void WriteSlnxProject(cmXMLElement& xmlParent, Solution const& solution,
   for (std::size_t i = 0; i < solution.Configs.size(); ++i) {
     if (project.Configs[i].Config != solution.Configs[i]) {
       cmXMLElement(xmlProject, "BuildType")
+        .Attribute("Solution", cmStrCat(solution.Configs[i], "|*"))
         .Attribute("Project", project.Configs[i].Config);
     }
     if (!project.Configs[i].Build) {

+ 3 - 1
Tests/RunCMake/include_external_msproject/CustomConfig-check-slnx.cmake

@@ -19,6 +19,8 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CustomConfig.slnx" [[
   <Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
   <Project Path="external.project" Id="aaa-bbb-ccc-000">
     <BuildDependency Project="ZERO_CHECK.vcxproj"/>
-    <BuildType Project="Custom - Release"/>
+    <BuildType Solution="Release\|\*" Project="Custom - Release"/>
+    <BuildType Solution="MinSizeRel\|\*" Project="Custom - MinSizeRel"/>
+    <BuildType Solution="RelWithDebInfo\|\*" Project="Custom - RelWithDebInfo"/>
   </Project>
 </Solution>$]])

+ 5 - 1
Tests/RunCMake/include_external_msproject/CustomConfig.cmake

@@ -1,3 +1,7 @@
 include_external_msproject(external external.project
                            GUID aaa-bbb-ccc-000)
-set_target_properties(external PROPERTIES MAP_IMPORTED_CONFIG_RELEASE "Custom - Release")
+set_target_properties(external PROPERTIES
+  MAP_IMPORTED_CONFIG_RELEASE        "Custom - Release"
+  MAP_IMPORTED_CONFIG_MINSIZEREL     "Custom - MinSizeRel"
+  MAP_IMPORTED_CONFIG_RELWITHDEBINFO "Custom - RelWithDebInfo"
+)