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

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

Fixes: #27385
This commit is contained in:
Brad King
2025-11-13 11:49:41 -05:00
parent 39d4fc2bb4
commit 7c284f4278
3 changed files with 9 additions and 2 deletions

View File

@@ -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) {

View File

@@ -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>$]])

View File

@@ -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"
)