cmPackageInfoReader: Fix configuration-specific importing

Modify cmPackageInfoReader to also append the configuration to the
IMPORTED_CONFIGURATIONS property of every target which has configuration
specific properties. We retain pre-populating this with the package's
default_configurations (if specified) in order to ensure that those are
given preference, but we also need to add every configuration that
actually exists in order to ensure that the target is usable, especially
if default_configurations was not provided.
This commit is contained in:
Matthew Woehlke 2025-02-11 13:23:29 -05:00
parent 8137cf2822
commit 0ba5343b66

View File

@ -527,6 +527,13 @@ void cmPackageInfoReader::SetTargetProperties(
cmMakefile* makefile, cmTarget* target, Json::Value const& data,
std::string const& package, cm::string_view configuration) const
{
// Add configuration (if applicable).
if (!configuration.empty()) {
target->AppendProperty("IMPORTED_CONFIGURATIONS",
cmSystemTools::UpperCase(configuration),
makefile->GetBacktrace());
}
// Add compile and link features.
for (std::string const& def : ReadList(data, "compile_features")) {
AddCompileFeature(makefile, target, configuration, def);