diff options
| author | ruki <[email protected]> | 2021-01-11 23:45:36 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-01-11 23:45:36 +0800 |
| commit | bb1180282099720fae44bb619a97f325bd1b04e1 (patch) | |
| tree | 84da0a01625e80d086c99660504b1fbaac5b54a4 /xmake/core/tool/builder.lua | |
| parent | ab41e77a5db0ab37b4b2f54cc737cfc45c55a463 (diff) | |
| parent | 415cc70c5fff491510cbc667e756c86bf139e172 (diff) | |
Merge pull request #1188 from xmake-io/argv
fix add_defines bug
Diffstat (limited to 'xmake/core/tool/builder.lua')
| -rw-r--r-- | xmake/core/tool/builder.lua | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua index 984b23992..3433813c9 100644 --- a/xmake/core/tool/builder.lua +++ b/xmake/core/tool/builder.lua @@ -364,23 +364,20 @@ end -- preprocess flags function builder:_preprocess_flags(flags) - -- remove repeat - flags = table.unique(flags) - - -- split flag group, e.g. "-I /xxx" => {"-I", "/xxx"} + -- remove repeat first and split flags group, e.g. "-I /xxx" => {"-I", "/xxx"} + local unique = {} local results = {} for _, flag in ipairs(flags) do flag = flag:trim() - if #flag > 0 then + if #flag > 0 and not unique[flag] then if flag:find(" ", 1, true) then - table.join2(results, os.argv(flag)) + table.join2(results, os.argv(flag, {splitonly = true})) else table.insert(results, flag) end + unique[flag] = true end end - - -- get it return results end |
