aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/cli/rule.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/build/cli/rule.cxx b/build/cli/rule.cxx
index ef3b1dc..274f193 100644
--- a/build/cli/rule.cxx
+++ b/build/cli/rule.cxx
@@ -100,10 +100,11 @@ namespace build
//
cli_cxx* g (targets.find<cli_cxx> (t.dir, t.name));
- // If not but this target has a cli{} prerequisite, synthesize
- // the group.
+ // If not or if it has no prerequisites (happens when we use it to
+ // set cli.options) and this target has a cli{} prerequisite, then
+ // synthesize the group.
//
- if (g == nullptr)
+ if (g == nullptr || !g->has_prerequisites ())
{
for (prerequisite_member p: group_prerequisite_members (a, t))
{
@@ -113,7 +114,9 @@ namespace build
//
if (t.name == p.name ())
{
- g = &targets.insert<cli_cxx> (t.dir, t.name, trace);
+ if (g == nullptr)
+ g = &targets.insert<cli_cxx> (t.dir, t.name, trace);
+
g->prerequisites.emplace_back (p.as_prerequisite (trace));
}
else