From a9ff0bbb4c6227c53e4dcf1a6a4d1f14aaab0160 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 17 Mar 2021 23:00:06 +0800 Subject: fix tools/xmake --- xmake/core/package/package.lua | 5 +---- xmake/modules/package/tools/xmake.lua | 10 +++++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 30949661b..dcca352a6 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -644,13 +644,10 @@ function _instance:build_envs(lazy_loading) build_envs = {} setmetatable(build_envs, { __index = function (tbl, key) local value = config.get(key) - if value == nil then - value = self:toolconfig(key) - end if value == nil then value = self:tool(key) end - value = table.unique(table.join(table.wrap(value), self:config(key))) + value = table.unique(table.join(table.wrap(value), table.wrap(self:config(key)), self:toolconfig(key))) if #value > 0 then value = table.unwrap(value) rawset(tbl, key, value) diff --git a/xmake/modules/package/tools/xmake.lua b/xmake/modules/package/tools/xmake.lua index efe5e4f09..0c1cd2a14 100644 --- a/xmake/modules/package/tools/xmake.lua +++ b/xmake/modules/package/tools/xmake.lua @@ -74,19 +74,19 @@ function _get_configs(package, configs) end end end - if cflags then + if cflags and #cflags > 0 then table.insert(configs, "--cflags=" .. table.concat(cflags, ' ')) end - if cxflags then + if cxflags and #cxflags > 0 then table.insert(configs, "--cxflags=" .. table.concat(cxflags, ' ')) end - if cxxflags then + if cxxflags and #cxxflags > 0 then table.insert(configs, "--cxxflags=" .. table.concat(cxxflags, ' ')) end - if asflags then + if asflags and #asflags > 0 then table.insert(configs, "--asflags=" .. table.concat(asflags, ' ')) end - if ldflags then + if ldflags and #ldflags > 0 then table.insert(configs, "--ldflags=" .. table.concat(ldflags, ' ')) end return configs -- cgit v1.3.1