From 7c284f4278e72632fc91c1bc2fb3078d93a382f1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 13 Nov 2025 11:49:41 -0500 Subject: [PATCH] VS: Fix SLNX with multiple solution-to-project configuration mappings Filter each mapping to apply only to its intended solution-wide config. Fixes: #27385 --- Source/cmVSSolution.cxx | 1 + .../CustomConfig-check-slnx.cmake | 4 +++- .../RunCMake/include_external_msproject/CustomConfig.cmake | 6 +++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Source/cmVSSolution.cxx b/Source/cmVSSolution.cxx index 7b0c04e67b..f85231d9a6 100644 --- a/Source/cmVSSolution.cxx +++ b/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) { diff --git a/Tests/RunCMake/include_external_msproject/CustomConfig-check-slnx.cmake b/Tests/RunCMake/include_external_msproject/CustomConfig-check-slnx.cmake index 7ccf4f76d2..439d9ffb66 100644 --- a/Tests/RunCMake/include_external_msproject/CustomConfig-check-slnx.cmake +++ b/Tests/RunCMake/include_external_msproject/CustomConfig-check-slnx.cmake @@ -19,6 +19,8 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CustomConfig.slnx" [[ - + + + $]]) diff --git a/Tests/RunCMake/include_external_msproject/CustomConfig.cmake b/Tests/RunCMake/include_external_msproject/CustomConfig.cmake index 1f935cd58c..1afaa0e3be 100644 --- a/Tests/RunCMake/include_external_msproject/CustomConfig.cmake +++ b/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" +)