diff options
| author | ruki <[email protected]> | 2026-02-01 12:50:41 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-02-01 12:50:41 +0800 |
| commit | 58ca9ee7a7bb05fe5a8706f9c3966ded3534163f (patch) | |
| tree | 8aed7620183550415802cf2ebdba0aa4f93b13ee | |
| parent | 9f2b25fb6b4682b0e82ca1bdcfc0ae24ff9e668d (diff) | |
improve tips
| -rw-r--r-- | xmake/modules/detect/sdks/find_vstudio.lua | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/xmake/modules/detect/sdks/find_vstudio.lua b/xmake/modules/detect/sdks/find_vstudio.lua index 0035a88ce..82cdfb643 100644 --- a/xmake/modules/detect/sdks/find_vstudio.lua +++ b/xmake/modules/detect/sdks/find_vstudio.lua @@ -21,6 +21,7 @@ -- imports import("core.base.option") import("core.base.semver") +import("core.base.hashset") import("core.project.config") import("lib.detect.find_file") import("lib.detect.find_tool") @@ -395,13 +396,24 @@ function _check_vcvarsall_env(vars) local value_org = _env_orgs[name] if value_org == nil then value_org = os.getenv(name) - _env_orgs[name] = value_org or false + if value_org then + _env_orgs[name] = path.splitenv(value_org) + else + _env_orgs[name] = false + end + value_org = _env_orgs[name] end local value_new = vars[name] or vars[name:lower()] if value_org and value_new and #value_org > 0 then - for _, p in ipairs(path.splitenv(value_org)) do - if not value_new:find(p, 1, true) then - wprint("%%%s%% is too long and truncated, detect msvc may be failed, please clear some unused variables!\n > %s", name, p:sub(1, 1024)) + local values_new = hashset.from(path.splitenv(value_new)) + for _, p in ipairs(value_org) do + if not values_new:has(p) then + if option.get("diagnosis") then + if #p > 256 then + p = p:sub(1, 256) .. "..." + end + wprint("%%%s%% is too long and truncated, detect msvc may be failed, please clear some unused variables!\n > %s", name, p) + end break end end |
