summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-01-19 21:06:16 +0800
committerGitHub <[email protected]>2024-01-19 21:06:16 +0800
commit8545a9301139aa8a778c4b61a1a3b6eaf40385e5 (patch)
tree350a85cd7f778a026810493e8656af4f70b2a67c
parent33cde167c8f85a8be7797c566e800a57fd375967 (diff)
parentb9b4a6e84f1cdd56bcc32c8eed900982fd9bc3b9 (diff)
Merge pull request #4628 from xmake-io/vs
improve vs cache key
-rw-r--r--xmake/modules/detect/sdks/find_vstudio.lua14
1 files changed, 10 insertions, 4 deletions
diff --git a/xmake/modules/detect/sdks/find_vstudio.lua b/xmake/modules/detect/sdks/find_vstudio.lua
index 104a2ca79..d928fafe7 100644
--- a/xmake/modules/detect/sdks/find_vstudio.lua
+++ b/xmake/modules/detect/sdks/find_vstudio.lua
@@ -435,17 +435,23 @@ end
-- , 2017 = {version = "15.0", vcvarsall = {x64 = {path = .., lib = ..}}}}
--
function main(opt)
+ opt = opt or {}
-- only for windows
if not is_host("windows") then
return
end
+ local key = "vstudio"
+ if opt.vcvars_ver then
+ key = key .. opt.vcvars_ver
+ end
+
-- attempt to get it from the global cache first
- local vstudio = global_detectcache:get2("vstudio", "msvc")
+ local vstudio = global_detectcache:get2(key, "msvc")
if vstudio then
local mtime = _get_last_mtime(vstudio)
- local mtimeprev = global_detectcache:get2("vstudio", "mtime")
+ local mtimeprev = global_detectcache:get2(key, "mtime")
if mtime and mtimeprev and mtime > 0 and mtimeprev > 0 and mtime == mtimeprev then
return vstudio
end
@@ -455,8 +461,8 @@ function main(opt)
vstudio = _find_vstudio(opt)
if vstudio then
local mtime = _get_last_mtime(vstudio)
- global_detectcache:set2("vstudio", "msvc", vstudio)
- global_detectcache:set2("vstudio", "mtime", mtime)
+ global_detectcache:set2(key, "msvc", vstudio)
+ global_detectcache:set2(key, "mtime", mtime)
global_detectcache:save()
end
return vstudio