summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-08-20 21:21:54 +0800
committerruki <[email protected]>2022-08-20 21:22:00 +0800
commitdb90d109c6ccf2545e8a3ae186ddfea1c99be61f (patch)
tree29ef809f6af051bc8a43e6dc1af3a854dbe55669
parent9accd1da89561c8695fec341a0c61768112953e5 (diff)
fix check cxsnippet
-rw-r--r--xmake/modules/lib/detect/check_cxsnippets.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/xmake/modules/lib/detect/check_cxsnippets.lua b/xmake/modules/lib/detect/check_cxsnippets.lua
index f41519ca4..37ba18ea4 100644
--- a/xmake/modules/lib/detect/check_cxsnippets.lua
+++ b/xmake/modules/lib/detect/check_cxsnippets.lua
@@ -200,9 +200,11 @@ function main(snippets, opt)
-- @note we use fixed temporary filenames in order to better cache the compilation results for build_cache.
local tmpfile = os.tmpfile(sourcecode)
local sourcefile = tmpfile .. extension
- local objectfile = tmpfile .. ".o"
- local binaryfile = tmpfile .. ".b"
- io.writefile(sourcefile, sourcecode)
+ local objectfile = os.tmpfile() .. ".o"
+ local binaryfile = objectfile:gsub("%.o$", ".b")
+ if not os.isfile(sourcefile) then
+ io.writefile(sourcefile, sourcecode)
+ end
-- @note cannot cache result, all conditions will be changed
-- attempt to compile it
@@ -237,7 +239,6 @@ function main(snippets, opt)
}
-- remove some files
- os.tryrm(sourcefile)
os.tryrm(objectfile)
os.tryrm(binaryfile)