aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc/install-rule.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-07-07 08:40:42 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-07-07 08:40:42 +0200
commit9ce886d010dee58e5d3e547df84da487fd1c4220 (patch)
treeb35ce7bf643ad8079be45737fd3e745b1d8791a1 /libbuild2/cc/install-rule.cxx
parent9a9276e1d151910ba31db4d91521b41e5ea1435f (diff)
Skip sources of executables in cc::install_rule
Failed that, they may pull headers via an ad hoc group.
Diffstat (limited to 'libbuild2/cc/install-rule.cxx')
-rw-r--r--libbuild2/cc/install-rule.cxx27
1 files changed, 23 insertions, 4 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;
}
}