diff options
| author | ruki <[email protected]> | 2023-11-07 23:01:10 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-11-07 23:01:10 +0800 |
| commit | 8f300c68633b474a2e2042abb0b01afc2f696e74 (patch) | |
| tree | 451e18a8214b8c3feaae78e808bd82144f40acaf | |
| parent | 4df9120342c6f958c42d7feb66480420555f498f (diff) | |
improve to find clang-cl
| -rw-r--r-- | xmake/modules/detect/tools/find_clang_cl.lua | 1 | ||||
| -rw-r--r-- | xmake/toolchains/clang-cl/check.lua | 9 |
2 files changed, 7 insertions, 3 deletions
diff --git a/xmake/modules/detect/tools/find_clang_cl.lua b/xmake/modules/detect/tools/find_clang_cl.lua index 3060cdc0b..3154484c0 100644 --- a/xmake/modules/detect/tools/find_clang_cl.lua +++ b/xmake/modules/detect/tools/find_clang_cl.lua @@ -40,7 +40,6 @@ function main(opt) opt = opt or {} -- find program - opt.envs = os.getenvs() -- get clang-cl from $PATH (LLVM/bin) first local program = find_program(opt.program or "clang-cl.exe", opt) -- find program version diff --git a/xmake/toolchains/clang-cl/check.lua b/xmake/toolchains/clang-cl/check.lua index a2397908e..515c3d639 100644 --- a/xmake/toolchains/clang-cl/check.lua +++ b/xmake/toolchains/clang-cl/check.lua @@ -68,8 +68,13 @@ function _check_vsenv(toolchain) toolchain:config_set("vs_sdkver", vcvars.WindowsSDKVersion) -- check compiler - local program = nil - local tool = find_tool("clang-cl.exe", {version = true, force = true, envs = vcvars}) + local program + local paths + local pathenv = os.getenv("PATH") + if pathenv then + paths = path.splitenv(pathenv) + end + local tool = find_tool("clang-cl.exe", {version = true, force = true, paths = paths, envs = vcvars}) if tool then program = tool.program end |
