summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-01-12 00:30:15 +0800
committerruki <[email protected]>2021-01-12 00:30:15 +0800
commit415cc70c5fff491510cbc667e756c86bf139e172 (patch)
tree2008e42f6af6f9bcc5964b011e7891c4b8047fef
parentbbb48dbc7ee40d510ff6a192417b1b4497d0ca95 (diff)
improve preprocess flags
-rw-r--r--xmake/core/tool/builder.lua11
1 files changed, 4 insertions, 7 deletions
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua
index 00067b435..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, {splitonly = true}))
else
table.insert(results, flag)
end
+ unique[flag] = true
end
end
-
- -- get it
return results
end