diff options
| author | ruki <[email protected]> | 2025-10-13 22:47:02 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-10-13 22:47:02 +0800 |
| commit | 896af38a1574304b2aad2894b6bc6aa6545f98b9 (patch) | |
| tree | 1e2847c0ff2a63d99286fa99b51a05827eb5c185 | |
| parent | d924be44bcd6d898363e7157e171903173cfd461 (diff) | |
improve to find cl
| -rw-r--r-- | xmake/modules/core/tools/cl/parse_include.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/core/tools/link/has_flags.lua | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/xmake/modules/core/tools/cl/parse_include.lua b/xmake/modules/core/tools/cl/parse_include.lua index e53163e8f..597e033f8 100644 --- a/xmake/modules/core/tools/cl/parse_include.lua +++ b/xmake/modules/core/tools/cl/parse_include.lua @@ -31,14 +31,14 @@ function probe_include_note_from_cl() local key = "cldeps.parse_include.note" local note = detectcache:get(key) if not note then - local cl = find_tool("cl") + local runenvs = toolchain.load("msvc"):runenvs() + local cl = find_tool("cl", {envs = runenvs}) if cl then local projectdir = os.tmpfile() .. ".cldeps" local sourcefile = path.join(projectdir, "main.c") local headerfile = path.join(projectdir, "foo.h") local objectfile = sourcefile .. ".obj" local outdata = try { function() - local runenvs = toolchain.load("msvc"):runenvs() local argv = {"-nologo", "-showIncludes", "-c", "-Fo" .. objectfile, sourcefile} io.writefile(headerfile, "\n") io.writefile(sourcefile, [[ diff --git a/xmake/modules/core/tools/link/has_flags.lua b/xmake/modules/core/tools/link/has_flags.lua index 5fcb15543..9d44b7b1c 100644 --- a/xmake/modules/core/tools/link/has_flags.lua +++ b/xmake/modules/core/tools/link/has_flags.lua @@ -72,7 +72,7 @@ function _check_try_running(flags, opt) -- compile the source file local objectfile = os.tmpfile() .. ".obj" local binaryfile = os.tmpfile() .. ".exe" - local cl = find_tool("cl") + local cl = find_tool("cl", {envs = opt.envs}) if cl then os.runv(cl.program, {"-c", "-nologo", "-Fo" .. objectfile, sourcefile}, {envs = opt.envs}) end |
