aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/cc/install-rule.cxx27
-rw-r--r--libbuild2/target.hxx10
2 files changed, 28 insertions, 9 deletions
diff --git a/libbuild2/cc/install-rule.cxx b/libbuild2/cc/install-rule.cxx
index 17cf4ab..dc10543 100644
--- a/libbuild2/cc/install-rule.cxx
+++ b/libbuild2/cc/install-rule.cxx
@@ -82,15 +82,26 @@ namespace build2
// Note that if they come from a group, then we assume the entire
// group is not to be installed.
//
+ // We also skip sources since they may "pull" a header if they are a
+ // member of an ad hoc group.
+ //
+ auto header_source = [this] (const auto& p)
+ {
+ return (x_header (p) ||
+ p.is_a (x_src) ||
+ (x_mod != nullptr && p.is_a (*x_mod)));
+ };
+
if (t.is_a<exe> ())
{
- if (x_header (p))
+ if (header_source (p))
pt = nullptr;
else if (p.type.see_through)
{
for (i.enter_group (); i.group (); )
{
- if (x_header (*++i))
+ ++i; // Note that we have to iterate until the end of the group.
+ if (pt != nullptr && header_source (*i))
pt = nullptr;
}
}
@@ -300,15 +311,23 @@ namespace build2
if (pt == nullptr)
return pt;
+ auto header_source = [this] (const auto& p)
+ {
+ return (x_header (p) ||
+ p.is_a (x_src) ||
+ (x_mod != nullptr && p.is_a (*x_mod)));
+ };
+
if (t.is_a<libue> ())
{
- if (x_header (p))
+ if (header_source (p))
pt = nullptr;
else if (p.type.see_through)
{
for (i.enter_group (); i.group (); )
{
- if (x_header (*++i))
+ ++i;
+ if (pt != nullptr && header_source (*i))
pt = nullptr;
}
}
diff --git a/libbuild2/target.hxx b/libbuild2/target.hxx
index a97097f..091b2d8 100644
--- a/libbuild2/target.hxx
+++ b/libbuild2/target.hxx
@@ -179,7 +179,7 @@ namespace build2
//
const target* group = nullptr;
- // What has been described above is a "explicit" group. That is, there is
+ // What has been described above is an "explicit" group. That is, there is
// a dedicated target type that explicitly serves as a group and there is
// an explicit mechanism for discovering the group's members.
//
@@ -195,10 +195,10 @@ namespace build2
// would be much easier and more consistent to make these extra files
// proper targets.
//
- // So to support this requirement we have ad hoc groups. The idea is
- // that any target can be turned either by a user's declaration in a
- // buildfile or by the rule that matches it into an ad hoc group by
- // chaining several targets together.
+ // So to support this requirement we have ad hoc groups. The idea is that
+ // any target can be turned either by a user's declaration in a buildfile
+ // or by the rule that matches it into an ad hoc group by chaining several
+ // targets together.
//
// Ad hoc groups have a more restricted semantics compared to the normal
// groups. In particular: