summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-11-25 22:57:59 +0800
committerruki <[email protected]>2024-11-25 22:57:59 +0800
commit905455a7bf3d74db7d79d1e88dd27d7d000af67e (patch)
tree0be38fa246ffd4fbb158c019d6073adc9629f239
parent09920ae45de7e15b46a0677c474cde18016bc9e2 (diff)
fix cl/has_flags for msvc-wine
-rw-r--r--xmake/modules/detect/tools/cl/has_flags.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/xmake/modules/detect/tools/cl/has_flags.lua b/xmake/modules/detect/tools/cl/has_flags.lua
index aced6332d..8bce7a83e 100644
--- a/xmake/modules/detect/tools/cl/has_flags.lua
+++ b/xmake/modules/detect/tools/cl/has_flags.lua
@@ -74,8 +74,17 @@ function _check_try_running(flags, opt)
local errors = nil
return try { function ()
local tmpdir = os.tmpdir()
- local _, errs = os.iorunv(opt.program, table.join("-c", "-nologo", flags, "-Fo" .. os.nuldev(), sourcefile),
+ local nuldev = os.nuldev()
+ local tmpfile
+ if not is_host("windows") then
+ tmpfile = os.tmpfile()
+ nuldev = tmpfile
+ end
+ local _, errs = os.iorunv(opt.program, table.join("-c", "-nologo", flags, "-Fo" .. nuldev, sourcefile),
{envs = opt.envs, curdir = tmpdir}) -- we need to switch to tmpdir to avoid generating some tmp files, e.g. /Zi -> vc140.pdb
+ if tmpfile then
+ os.tryrm(tmpfile)
+ end
if errs and #errs:trim() > 0 then
return false, errs
end