diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-03-14 17:20:02 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-03-14 17:20:02 +0200 |
commit | e20a351013745e8d6c3a0a99bd40c172ed0ae8be (patch) | |
tree | b0e6d24dbc097c2001e6bb4b0c0357bcb83bdc72 /build2/config/operation.cxx | |
parent | d1b3ad7b302d037c8154bab9c4810d499c0bf1e4 (diff) |
Add support for multiple variable overrides
Now we can do:
$ b config.cxx.coptions=-O3 config.cxx.coptions=-O0
Or even:
$ b config.cxx.coptions=-O3 config.cxx.coptions+=-g
Diffstat (limited to 'build2/config/operation.cxx')
-rw-r--r-- | build2/config/operation.cxx | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/build2/config/operation.cxx b/build2/config/operation.cxx index 724b92d..7d6fc74 100644 --- a/build2/config/operation.cxx +++ b/build2/config/operation.cxx @@ -131,7 +131,7 @@ namespace build2 const variable& var (sv.var); pair<lookup, size_t> org (root.find_original (var)); - pair<lookup, size_t> ovr (var.override == nullptr + pair<lookup, size_t> ovr (var.overrides == nullptr ? org : root.find_override (var, org)); const lookup& l (ovr.first); @@ -859,19 +859,11 @@ namespace build2 { const variable& var (p.first->first); - // Annoyingly, this is one of the __override/__prefix/__suffix - // values. So we strip the last component. + // Annoyingly, this can be (always is?) one of the overrides + // (__override, __prefix, etc). // - size_t n (var.name.size ()); - - if (var.name.compare (n - 11, 11, ".__override") == 0) - n -= 11; - else if (var.name.compare (n - 9, 9, ".__prefix") == 0) - n -= 9; - else if (var.name.compare (n - 9, 9, ".__suffix") == 0) - n -= 9; - - m.save_variable (*vp.find (string (var.name, 0, n))); + size_t n (var.override ()); + m.save_variable (n != 0 ? *vp.find (string (var.name, 0, n)) : var); } // Now project-specific. For now we just save all of them and let |