summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-02-12 22:34:49 +0800
committerruki <[email protected]>2021-02-12 22:34:49 +0800
commitc470ec0850309c75e089c3722376316bbe20bbd8 (patch)
treecf8ff6ae24a691ed3206072f8cbbd26540d132f0
parent257341fd5b31b6010cf2d0e782e37cb74f58e90c (diff)
fix tools/xmake
-rw-r--r--xmake/modules/package/tools/xmake.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/xmake/modules/package/tools/xmake.lua b/xmake/modules/package/tools/xmake.lua
index 55cbb47e6..1ebd2bbe7 100644
--- a/xmake/modules/package/tools/xmake.lua
+++ b/xmake/modules/package/tools/xmake.lua
@@ -86,8 +86,6 @@ function buildenvs(package, opt)
-- pass toolchains
local toolchains = package:config("toolchains")
if toolchains then
- local rcfile_path = os.tmpfile() .. ".lua"
- local rcfile = io.open(rcfile_path, 'w')
local toolchain_packages = {}
for _, name in ipairs(toolchains) do
local toolchain_inst = toolchain.load(name, {plat = package:plat(), arch = package:arch()})
@@ -95,7 +93,11 @@ function buildenvs(package, opt)
table.join2(toolchain_packages, toolchain_inst:config("packages"))
end
end
- rcfile:print("add_requires(\"%s\")", table.concat(toolchain_packages, '", "'))
+ local rcfile_path = os.tmpfile() .. ".lua"
+ local rcfile = io.open(rcfile_path, 'w')
+ if #toolchain_packages > 0 then
+ rcfile:print("add_requires(\"%s\")", table.concat(toolchain_packages, '", "'))
+ end
rcfile:print("add_toolchains(\"%s\")", table.concat(table.wrap(toolchains), '", "'))
rcfile:close()
envs.XMAKE_RCFILES = {}