aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-09-27 11:39:52 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-09-27 11:39:52 +0200
commit54390cf8ebc17eaebb2f053c5b62ba91bf1b4d7b (patch)
treea841d41b322b48fe9aee831d91d33bc64206d943
parent50d93195e9a67b75fdd87b6fe0106af2da4d56f8 (diff)
Allow search to find implied alias targets
Allowing this seems harmless since all the alias does is pull its prerequisites. And they are handy to use as metadata carriers.
-rw-r--r--libbuild2/target.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/libbuild2/target.cxx b/libbuild2/target.cxx
index 41a3273..768fc82 100644
--- a/libbuild2/target.cxx
+++ b/libbuild2/target.cxx
@@ -1176,9 +1176,13 @@ namespace build2
// For an alias we don't want to silently create a target since it will do
// nothing and it most likely not what the user intended.
//
+ // But, allowing implied aliases seems harmless since all the alias does
+ // is pull its prerequisites. And they are handy to use as metadata
+ // carriers.
+ //
const target* e (search_existing_target (t.ctx, pk));
- if (e == nullptr || e->decl != target_decl::real)
+ if (e == nullptr || !(operator>= (e->decl, target_decl::implied)))
fail << "no explicit target for " << pk;
return e;
@@ -1269,7 +1273,8 @@ namespace build2
{
tracer trace ("dir_search");
- // The first step is like in search_alias(): looks for an existing target.
+ // The first step is like in alias_search(): looks for an existing target
+ // (but unlike alias, no implied, think `test/: install=false`).
//
const target* e (search_existing_target (t.ctx, pk));