aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/parser.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-10-24 08:46:25 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-10-24 08:46:25 +0200
commit8bb6e9ab21f47e070a089e316c6795cc5b473b80 (patch)
tree0ec770a95f9a963f3265670e6a46db7a0cd350e8 /libbuild2/parser.cxx
parent27342e7a1066a3f1426a624a35e52c23bdedeed9 (diff)
Allow non-parallel absolute src/out to support imported target tagging
Also fix bug in out clearing.
Diffstat (limited to 'libbuild2/parser.cxx')
-rw-r--r--libbuild2/parser.cxx22
1 files changed, 11 insertions, 11 deletions
diff --git a/libbuild2/parser.cxx b/libbuild2/parser.cxx
index d5514b7..f0eafb3 100644
--- a/libbuild2/parser.cxx
+++ b/libbuild2/parser.cxx
@@ -2515,25 +2515,25 @@ namespace build2
o.dir.normalize (); // Note: don't collapse current to empty.
- // Make sure out and src are parallel.
- //
- // See similar code for targets in scope::find_target_type().
+ // Make sure out and src are parallel unless both were specified as
+ // absolute. We make an exception for this case because out may be
+ // used to "tag" imported targets (see cc::search_library()). So it's
+ // sort of the "I know what I am doing" escape hatch (it would have
+ // been even better to verify such a target is outside any project
+ // but that won't be cheap).
//
// For now we require that both are either relative or absolute.
//
- if (n.dir.empty () && o.dir.current ())
+ // See similar code for targets in scope::find_target_type().
+ //
+ if (n.dir.absolute () && o.dir.absolute ())
+ ;
+ else if (n.dir.empty () && o.dir.current ())
;
else if (o.dir.relative () &&
n.dir.relative () &&
o.dir == n.dir)
;
- else if (o.dir.absolute () &&
- n.dir.absolute () &&
- o.dir.sub (root_->out_path ()) &&
- n.dir.sub (root_->src_path ()) &&
- o.dir.leaf (root_->out_path ()) ==
- n.dir.leaf (root_->src_path ()))
- ;
else
fail (ploc) << "prerequisite output directory " << o.dir
<< " must be parallel to source directory " << n.dir;