Genex: Fix CONFIG on imported target with no explicit mapping

When evaluating the `$<CONFIG>` genex on an imported target has the
`IMPORTED_CONFIGURATIONS` property set, the current project has a config
that does not match any of those, and no explicit configuration mappings
are defined, fall back to the same configuration as `IMPORTED_LOCATION`.

Fixes: #24222
This commit is contained in:
Luis Caro Campos
2022-12-15 15:58:43 +01:00
committed by Brad King
parent dcb1c9c080
commit e455265d72
3 changed files with 16 additions and 0 deletions
+8
View File
@@ -1388,6 +1388,14 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
return "1";
}
}
} else if (!suffix.empty()) {
// There is no explicit mapping for the tested config, so use
// the configuration of the imported location that was selected.
for (auto const& param : parameters) {
if (cmStrCat('_', cmSystemTools::UpperCase(param)) == suffix) {
return "1";
}
}
}
}
}