summaryrefslogtreecommitdiff
path: root/xmake/modules/lib
diff options
context:
space:
mode:
authorruki <[email protected]>2020-06-20 16:18:51 +0800
committerruki <[email protected]>2020-06-20 16:18:51 +0800
commit966b8dd7a01b09a93ba21ee4d2df0d471ab2282c (patch)
tree144af8b8bebb12e441402dcc90325cbb9949b494 /xmake/modules/lib
parentda2e3b83c53752c43b651effeb273cb72090d7b0 (diff)
bind runenvs to has_flags
Diffstat (limited to 'xmake/modules/lib')
-rw-r--r--xmake/modules/lib/detect/has_flags.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/xmake/modules/lib/detect/has_flags.lua b/xmake/modules/lib/detect/has_flags.lua
index 833bbcf65..4e4f3535a 100644
--- a/xmake/modules/lib/detect/has_flags.lua
+++ b/xmake/modules/lib/detect/has_flags.lua
@@ -62,14 +62,14 @@ function main(name, flags, opt)
opt.programver = tool.version
-- get tool platform
- local plat = config.get("plat") or os.host()
+ local plat = opt.plat or config.get("plat") or os.host()
-- get tool architecture
--
-- some tools select arch by path environment, not be flags, e.g. cl.exe of msvc)
-- so, it will affect the cache result
--
- local arch = config.get("arch") or os.arch()
+ local arch = opt.arch or config.get("arch") or os.arch()
-- init cache key
local key = plat .. "_" .. arch .. "_" .. tool.program .. "_" .. (tool.version or "") .. "_" .. (opt.toolkind or "") .. "_" .. (opt.flagkind or "") .. "_" .. table.concat(opt.sysflags, " ") .. "_" .. opt.flagskey
@@ -113,7 +113,7 @@ function main(name, flags, opt)
if hasflags then
result, errors = hasflags(checkflags, opt)
else
- result = try { function () os.runv(tool.program, checkflags); return true end, catch { function (errs) errors = errs end }}
+ result = try { function () os.runv(tool.program, checkflags, {envs = opt.envs}); return true end, catch { function (errs) errors = errs end }}
end
_g._checking = nil
result = result or false