summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/core/tool/builder.lua1
-rw-r--r--xmake/modules/core/tools/cl/parse_include.lua4
-rw-r--r--xmake/modules/core/tools/link/has_flags.lua2
3 files changed, 4 insertions, 3 deletions
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua
index bc7e995a4..e6c649580 100644
--- a/xmake/core/tool/builder.lua
+++ b/xmake/core/tool/builder.lua
@@ -168,6 +168,7 @@ function builder:_add_flags_from_flagkind(flags, target, flagkind, opt)
flag = target_utils.flag_belong_to_tool(flag, self, extraconf)
if flag then
if extraconf then
+ local flagconf = extraconf[flag]
-- @note we need join the single flag with shallow mode, aboid expand table values
-- e.g. add_cflags({"-I", "/tmp/xxx foo"}, {force = true, expand = false})
if flagconf and flagconf.force then
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