Fix target FILE_SET properties

Ensure custom rules are taken into account.
This commit is contained in:
Marc Chevrier committed 2026-10-17 13:37:32 +02:00
1 parent 1cdd7458c0
commit 0adc84cf73
2 files changed
+24

No files matched your search

+14
View File
@@ -2095,6 +2095,10 @@ cmBTStringRange cmTarget::GetFileSetsEntries(cm::string_view type) const
if (cm::contains(this->impl->FileSetTypes, type)) {
return cmMakeRange(this->impl->FileSetTypes.at(type).SelfEntries.Entries);
}
auto strType = std::string{ type };
if (cm::contains(this->impl->FileSetRules, strType)) {
return cmMakeRange(this->impl->FileSetRules.at(strType).SelfEntries);
}
return cmMakeRange(EmptyEntries);
}
@@ -2105,6 +2109,10 @@ cmBTStringRange cmTarget::GetInterfaceFileSetsEntries(
return cmMakeRange(
this->impl->FileSetTypes.at(type).InterfaceEntries.Entries);
}
auto strType = std::string{ type };
if (cm::contains(this->impl->FileSetRules, strType)) {
return cmMakeRange(this->impl->FileSetRules.at(strType).InterfaceEntries);
}
return cmMakeRange(EmptyEntries);
}
@@ -2944,6 +2952,12 @@ cmValue cmTarget::GetProperty(std::string const& prop) const
types.push_back(fileSetType.first);
}
}
for (auto const& fileSetRule : this->impl->FileSetRules) {
if (!fileSetRule.second.SelfEntries.empty() ||
!fileSetRule.second.InterfaceEntries.empty()) {
types.push_back(fileSetRule.first);
}
}
std::sort(types.begin(), types.end());
fsTypes = types.to_string();
return cmValue{ fsTypes };
@@ -91,3 +91,13 @@ assert_prop_eq(lib1 FILE_SETS_HEADERS "a;b;HEADERS")
assert_prop_eq(lib1 INTERFACE_FILE_SETS_HEADERS "a;c;d;HEADERS")
assert_prop_eq(lib1 FILE_SETS_SOURCES "src1")
assert_prop_eq(lib1 INTERFACE_FILE_SETS_SOURCES "src1")
add_custom_rule(rule OUTPUT output COMMAND cmd)
target_sources(lib1 PUBLIC FILE_SET src2 TYPE rule FILES lib2.c)
assert_prop_eq(lib1 FILE_SET_TYPES "HEADERS;SOURCES;rule")
assert_prop_eq(lib1 FILE_SETS_HEADERS "a;b;HEADERS")
assert_prop_eq(lib1 INTERFACE_FILE_SETS_HEADERS "a;c;d;HEADERS")
assert_prop_eq(lib1 FILE_SETS_SOURCES "src1")
assert_prop_eq(lib1 INTERFACE_FILE_SETS_SOURCES "src1")
assert_prop_eq(lib1 FILE_SETS_rule "src2")
assert_prop_eq(lib1 INTERFACE_FILE_SETS_rule "src2")