diff options
-rw-r--r-- | build/cxx/link.cxx | 5 | ||||
-rw-r--r-- | build/install/rule.cxx | 14 | ||||
-rw-r--r-- | build/target | 11 |
3 files changed, 28 insertions, 2 deletions
diff --git a/build/cxx/link.cxx b/build/cxx/link.cxx index 6742ff2..f489a0d 100644 --- a/build/cxx/link.cxx +++ b/build/cxx/link.cxx @@ -405,9 +405,10 @@ namespace build // If we have any prerequisite libraries (which also means that // we match), search/import and pre-match them to implement the - // "library meta-information protocol". + // "library meta-information protocol". Don't do this if we are + // called from the install rule just to check if we would match. // - if (seen_lib && lt != type::e) + if (seen_lib && lt != type::e && a.operation () != install_id) { if (t.group != nullptr) t.group->prerequisite_targets.clear (); // lib{}'s diff --git a/build/install/rule.cxx b/build/install/rule.cxx index 6f0f95f..bd538ed 100644 --- a/build/install/rule.cxx +++ b/build/install/rule.cxx @@ -121,8 +121,16 @@ namespace build // run standard search_and_match()? Will need an indicator // that it was forced (e.g., [install]) for filter() below. // + scope& rs (t.root_scope ()); + for (prerequisite_member p: group_prerequisite_members (a, t)) { + // Ignore unresolved targets that are imported from other projects. + // We are definitely not installing those. + // + if (p.proj () != nullptr) + continue; + // @@ This is where we will handle [noinstall]. // @@ -134,6 +142,12 @@ namespace build continue; target& pt (p.search ()); + + // Ignore targets that are outside of our project. + // + if (!pt.in (rs)) + continue; + build::match (a, pt); // If the matched rule returned noop_recipe, then the target diff --git a/build/target b/build/target index d4a4bef..a866c98 100644 --- a/build/target +++ b/build/target @@ -205,6 +205,8 @@ namespace build target_key key () const {return target_key {&type (), &dir, &name, &ext};} + // Scoping. + // public: // Most qualified scope that contains this target. // @@ -225,6 +227,15 @@ namespace build scope& strong_scope () const {return *root_scope ().strong_scope ();} + + bool + in (const scope& s) const + { + return + (s.out_path_ != nullptr && dir.sub (*s.out_path_)) || + (s.src_path_ != nullptr && dir.sub (*s.src_path_)); + } + // Prerequisites. // public: |