diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-05-25 11:19:04 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-05-28 10:10:44 +0200 |
commit | 6b3e75edf034ebcbd048a24c283c7bcf7b1da019 (patch) | |
tree | 4dff34692fd09c6f201a486c0d92549adc864947 /libbuild2/name.ixx | |
parent | bb02e152dc036879ab0b2d1d8aa2cb19084b8e16 (diff) |
Add support for regex-based target type/pattern specific variables
This is in addition to the already supported path-based target type/pattern
specific variables. For example:
hxx{*}: x = y # path-based
hxx{~/.*/}: x = y # regex-based
Diffstat (limited to 'libbuild2/name.ixx')
-rw-r--r-- | libbuild2/name.ixx | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libbuild2/name.ixx b/libbuild2/name.ixx index 80a097e..a3ee94b 100644 --- a/libbuild2/name.ixx +++ b/libbuild2/name.ixx @@ -21,7 +21,20 @@ namespace build2 r = pair < x.pair ? -1 : (pair > x.pair ? 1 : 0); if (r == 0) - r = pattern == x.pattern ? 0 : (!pattern && x.pattern ? -1 : 1); + { + bool p (pattern); + bool xp (x.pattern); + + r = p == xp ? 0 : (p ? 1 : -1); + + if (r == 0 && p) + { + auto p (static_cast<uint8_t> (*pattern)); + auto xp (static_cast<uint8_t> (*x.pattern)); + + r = p < xp ? -1 : (p > xp ? 1 : 0); + } + } return r; } |