From f93038fbee1631b95922b0742e0fd00fa8dae02e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 27 Jan 2017 15:25:26 +0200 Subject: Add notion of phase, enforce --- build2/search.cxx | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'build2/search.cxx') diff --git a/build2/search.cxx b/build2/search.cxx index ef4814d..65eb2fd 100644 --- a/build2/search.cxx +++ b/build2/search.cxx @@ -31,7 +31,7 @@ namespace build2 d = *tk.dir; // Already normalized. else { - d = pk.scope->out_path (); + d = tk.out->empty () ? pk.scope->out_path () : pk.scope->src_path (); if (!tk.dir->empty ()) { @@ -51,12 +51,27 @@ namespace build2 // // relative The out directory was specified using @-syntax as relative (to // the prerequisite's scope) and we need to complete it similar - // to how we complete the relative dir above. This is @@ OUT TODO. - // - // What if we have user-supplied out but it is in-src build. Shouldn't we - // drop it? + // to how we complete the relative dir above. // - auto i (targets.find (*tk.type, d, *tk.out, *tk.name, tk.ext, trace)); + dir_path o; + if (!tk.out->empty ()) + { + if (tk.out->absolute ()) + o = *tk.out; // Already normalized. + else + { + o = pk.scope->out_path (); + o /= *tk.out; + o.normalize (); + } + + // Drop out if it is the same as src (in-src build). + // + if (o == d) + o.clear (); + } + + auto i (targets.find (*tk.type, d, o, *tk.name, tk.ext, trace)); if (i == targets.end ()) return 0; -- cgit v1.1