summaryrefslogtreecommitdiff
path: root/xmake/modules/lib/detect/has_flags.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-07-14 12:43:16 +0800
committerruki <[email protected]>2017-07-14 12:43:16 +0800
commitf39f4a27d43a1f63d56ae3c9f7fc34b5158e299a (patch)
tree37d3667077443d79f9f1425d8aa9d54b42ff8599 /xmake/modules/lib/detect/has_flags.lua
parentbe1cbe6488d15f3f802539dacc74bc98471268f0 (diff)
fix has_flags when generating vs201x project
Diffstat (limited to 'xmake/modules/lib/detect/has_flags.lua')
-rw-r--r--xmake/modules/lib/detect/has_flags.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/xmake/modules/lib/detect/has_flags.lua b/xmake/modules/lib/detect/has_flags.lua
index 1957a6b72..614049821 100644
--- a/xmake/modules/lib/detect/has_flags.lua
+++ b/xmake/modules/lib/detect/has_flags.lua
@@ -24,6 +24,7 @@
-- imports
import("core.base.option")
+import("core.project.config")
import("lib.detect.find_tool")
-- has the given flags for the current tool?
@@ -74,8 +75,15 @@ function main(name, flags, opt)
opt.program = tool.program
opt.programver = tool.version
+ -- get tool arch
+ --
+ -- 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()
+
-- init cache and key
- local key = tool.program .. "_" .. (tool.version or "") .. "_" .. (opt.toolkind or "") .. "_" .. table.concat(flags, " ")
+ local key = tool.program .. "_" .. (tool.version or "") .. "_" .. (opt.toolkind or "") .. "_" .. table.concat(flags, " ") .. "_" .. arch
_g._RESULTS = _g._RESULTS or {}
local results = _g._RESULTS