From f912a6c1090875b16792da4848c47759a38f1ef4 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 29 Apr 2017 08:58:07 +0200 Subject: Fix bug in default target logic --- build2/target.cxx | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) (limited to 'build2/target.cxx') diff --git a/build2/target.cxx b/build2/target.cxx index 1922570..f7500f7 100644 --- a/build2/target.cxx +++ b/build2/target.cxx @@ -819,31 +819,33 @@ namespace build2 t = search_existing_target (pk); if (t != nullptr && !t->implied) - return t; - - // Ok, no luck, switch the scope. - // - pair sp ( - switch_scope (*s.rw ().root_scope (), out_base)); - - if (sp.second != nullptr) // Ignore scopes out of any project. + retest = true; + else { - scope& base (sp.first); - scope& root (*sp.second); + // Ok, no luck, switch the scope. + // + pair sp ( + switch_scope (*s.rw ().root_scope (), out_base)); - const dir_path& src_base (base.src_path ()); - - path bf (src_base / "buildfile"); - - if (exists (bf)) - { - l5 ([&]{trace << "loading buildfile " << bf << " for " << pk;}); - retest = source_once (root, base, bf, root); - } - else if (exists (src_base)) + if (sp.second != nullptr) // Ignore scopes out of any project. { - t = dir::search_implied (base, pk, trace); - retest = (t != nullptr); + scope& base (sp.first); + scope& root (*sp.second); + + const dir_path& src_base (base.src_path ()); + + path bf (src_base / "buildfile"); + + if (exists (bf)) + { + l5 ([&]{trace << "loading buildfile " << bf << " for " << pk;}); + retest = source_once (root, base, bf, root); + } + else if (exists (src_base)) + { + t = dir::search_implied (base, pk, trace); + retest = (t != nullptr); + } } } } -- cgit v1.1