summaryrefslogtreecommitdiff
path: root/xmake/core/tool/compiler.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-07-13 10:52:42 +0800
committerruki <[email protected]>2017-07-13 10:52:42 +0800
commitb7ae88c507b9afe89cd677ee81894e44a961a4b4 (patch)
treea8aca817b422ca83f76d8310678351eaa3f3cf75 /xmake/core/tool/compiler.lua
parentb9e5a411e38224db1f71a39cad57cc54dc13fee6 (diff)
improve flags for linker and compiler
Diffstat (limited to 'xmake/core/tool/compiler.lua')
-rw-r--r--xmake/core/tool/compiler.lua20
1 files changed, 18 insertions, 2 deletions
diff --git a/xmake/core/tool/compiler.lua b/xmake/core/tool/compiler.lua
index 3aad4c642..00d05fa6c 100644
--- a/xmake/core/tool/compiler.lua
+++ b/xmake/core/tool/compiler.lua
@@ -254,13 +254,29 @@ function compiler:compflags(opt)
-- add flags from the compiler
self:_addflags_from_compiler(flags, targetkind)
+ -- remove repeat
+ flags = table.unique(flags)
+
+ -- split flag group, .e.g "-I /xxx" => {"-I", "/xxx"}
+ local results = {}
+ for _, flag in ipairs(flags) do
+ flag = flag:trim()
+ if #flag > 0 then
+ if flag:find(" ", 1, true) then
+ table.join2(results, os.argv(flag))
+ else
+ table.insert(results, flag)
+ end
+ end
+ end
+
-- save flags
if key then
- self._FLAGS[key] = flags
+ self._FLAGS[key] = results
end
-- get it
- return flags
+ return results
end
-- return module