diff options
| author | ruki <[email protected]> | 2024-02-22 23:34:05 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-02-22 23:34:05 +0800 |
| commit | c2c25429dcca196253183a83388306bb1716a5c3 (patch) | |
| tree | 99004303f4d31d22ac9965de589f1881b8ff7a90 | |
| parent | add07b3a9316f96adbf7519e10cc2a7e52f3cd4f (diff) | |
find current msvc envs
| -rw-r--r-- | xmake/modules/package/tools/cmake.lua | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index 5183f80c1..77520b6a3 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -94,13 +94,17 @@ end -- get msvc run environments function _get_msvc_runenvs(package) local envs = {} + local curenvs = os.getenvs() for k, v in pairs(os.joinenvs(_get_msvc(package):runenvs())) do - local k_upper = k:upper() - local k_lower = k:lower() - if k_upper ~= k and os.getenv(k_upper) then - envs[k_upper] = v - elseif k_lower ~= k and os.getenv(k_lower) then - envs[k_lower] = v + local ck_found + for ck, cv in pairs(curenvs) do + if k:lower() == ck:lower() and k ~= ck then + ck_found = ck + break + end + end + if ck_found then + envs[ck_found] = v else envs[k] = v end |
