From 0ba5343b66d6a61027ff23df4cf96574ee88eaaf Mon Sep 17 00:00:00 2001 From: Matthew Woehlke Date: Tue, 11 Feb 2025 13:23:29 -0500 Subject: 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. --- Source/cmPackageInfoReader.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/cmPackageInfoReader.cxx b/Source/cmPackageInfoReader.cxx index a5349ca..4d8759d 100644 --- a/Source/cmPackageInfoReader.cxx +++ b/Source/cmPackageInfoReader.cxx @@ -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); -- cgit v0.12