aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/parser.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-07-21 11:54:59 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-07-21 11:54:59 +0200
commit3f6a5deac97cdf85186c6e1164ce6895eb38c36f (patch)
treebd085585d183177474b27b12a7eecfea9e547eb6 /libbuild2/parser.cxx
parent9c03dbab42d4499890955a98d30d91290d714d9a (diff)
Don't issue conditional dependency declaration warning for imported projects
Diffstat (limited to 'libbuild2/parser.cxx')
-rw-r--r--libbuild2/parser.cxx26
1 files changed, 19 insertions, 7 deletions
diff --git a/libbuild2/parser.cxx b/libbuild2/parser.cxx
index dec23df..0ce0cfe 100644
--- a/libbuild2/parser.cxx
+++ b/libbuild2/parser.cxx
@@ -24,6 +24,8 @@
#include <libbuild2/adhoc-rule-regex-pattern.hxx>
+#include <libbuild2/dist/module.hxx> // module
+
#include <libbuild2/config/utility.hxx> // lookup_config
using namespace std;
@@ -2385,13 +2387,23 @@ namespace build2
ctx->current_mif != nullptr &&
ctx->current_mif->id == dist_id)
{
- warn (tloc) << "conditional dependency declaration may result in "
- << "incomplete distribution" <<
- info (ploc) << "prerequisite declared here" <<
- info (*condition_) << "conditional buildfile fragment starts here" <<
- info << "instead use 'include' prerequisite-specific variable to "
- << "conditionally include prerequisites" <<
- info << "for example: <target>: <prerequisite>: include = (<condition>)";
+ // Only issue the warning for the projects being distributed. In
+ // particular, this makes sure we don't complain about imported
+ // projects.
+ //
+ auto* dm (root_->find_module<dist::module> (dist::module::name));
+
+ if (dm != nullptr && dm->distributed)
+ {
+ warn (tloc) << "conditional dependency declaration may result in "
+ << "incomplete distribution" <<
+ info (ploc) << "prerequisite declared here" <<
+ info (*condition_) << "conditional buildfile fragment starts here" <<
+ info << "instead use 'include' prerequisite-specific variable to "
+ << "conditionally include prerequisites" <<
+ info << "for example: "
+ << "<target>: <prerequisite>: include = (<condition>)";
+ }
}
// First enter all the targets.