From 7a16a7339dee73b150ee39d92e272f3e59c1fc2d Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 29 Nov 2020 10:32:59 +0800 Subject: improve preprocess flags --- xmake/core/tool/builder.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'xmake/core/tool/builder.lua') diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua index e706a9933..ba8d44a18 100644 --- a/xmake/core/tool/builder.lua +++ b/xmake/core/tool/builder.lua @@ -373,9 +373,15 @@ function builder:_preprocess_flags(flags) flag = flag:trim() if #flag > 0 then if flag:find(" ", 1, true) then + local split = true -- ignore e.g. -DTEST="Hello world" - local s = flag:gsub("\".-\"", "") - if s:find(" ", 1, true) then + if flag:find("\"", 1, true) then + local s = flag:gsub("\".-\"", "") + if not s:find(" ", 1, true) then + split = false + end + end + if split then table.join2(results, os.argv(flag)) else table.insert(results, flag) -- cgit v1.3.1