diff options
| author | jinke18 <[email protected]> | 2024-07-29 22:47:14 +0800 |
|---|---|---|
| committer | jinke18 <[email protected]> | 2024-07-29 22:47:14 +0800 |
| commit | d40756de311f62d81a8a02b1701eb809586a0c0f (patch) | |
| tree | aa8b10e216c3f2a0ca3a714491d1724a3c7f98d4 | |
| parent | 71ec32ea6787c1c4b215ea40e1d5ab40c1c4eedc (diff) | |
fixbug: for cases when WindowsSDKVersion variable is not available
| -rw-r--r-- | xmake/modules/detect/sdks/find_vstudio.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/xmake/modules/detect/sdks/find_vstudio.lua b/xmake/modules/detect/sdks/find_vstudio.lua index 2ce2b44eb..ca49d8d07 100644 --- a/xmake/modules/detect/sdks/find_vstudio.lua +++ b/xmake/modules/detect/sdks/find_vstudio.lua @@ -186,6 +186,16 @@ function _load_vcvarsall(vcvarsall, vsver, arch, opt) if WindowsSDKVersion ~= "" then variables["WindowsSDKVersion"] = WindowsSDKVersion end + else + -- sometimes the variable `WindowsSDKVersion` is not available + -- then parse it from `WindowsSdkBinPath`, such as: `C:\\Program Files (x86)\\Windows Kits\\8.1\\bin` + local WindowsSdkBinPath = variables["WindowsSdkBinPath"] + if WindowsSdkBinPath then + WindowsSDKVersion = string.match(WindowsSdkBinPath, "\\(%d+%.?%d*)\\bin") + if WindowsSDKVersion then + variables["WindowsSDKVersion"] = WindowsSDKVersion + end + end end -- fix UCRTVersion |
