From 3f6a5deac97cdf85186c6e1164ce6895eb38c36f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 21 Jul 2022 11:54:59 +0200 Subject: Don't issue conditional dependency declaration warning for imported projects --- libbuild2/parser.cxx | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'libbuild2/parser.cxx') 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 +#include // module + #include // 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: : : include = ()"; + // 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::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: " + << ": : include = ()"; + } } // First enter all the targets. -- cgit v1.1