aboutsummaryrefslogtreecommitdiff
path: root/build2/search.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-01-27 15:25:26 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-02-13 12:42:41 +0200
commitf93038fbee1631b95922b0742e0fd00fa8dae02e (patch)
tree6fe67cbde528ee8ded490085b9a8d5adc0ce5aca /build2/search.cxx
parent267d34d2800d9cc3ed2865cbecf8d32f8f1ab6ec (diff)
Add notion of phase, enforce
Diffstat (limited to 'build2/search.cxx')
-rw-r--r--build2/search.cxx27
1 files changed, 21 insertions, 6 deletions
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;