summaryrefslogtreecommitdiff
path: root/xmake/modules/detect/tools/gcc/has_flags.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/modules/detect/tools/gcc/has_flags.lua')
-rw-r--r--xmake/modules/detect/tools/gcc/has_flags.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/xmake/modules/detect/tools/gcc/has_flags.lua b/xmake/modules/detect/tools/gcc/has_flags.lua
index 64fa70df8..6ab7ce810 100644
--- a/xmake/modules/detect/tools/gcc/has_flags.lua
+++ b/xmake/modules/detect/tools/gcc/has_flags.lua
@@ -77,9 +77,10 @@ end
function _check_try_running(flags, opt, islinker)
-- make an stub source file
- local sourcefile = path.join(os.tmpdir(), "detect", "gcc_has_flags" .. _get_extension(opt))
+ local snippet = opt.snippet or "int main(int argc, char** argv)\n{return 0;}"
+ local sourcefile = os.tmpfile("gcc_has_flags:" .. snippet) .. _get_extension(opt)
if not os.isfile(sourcefile) then
- io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}")
+ io.writefile(sourcefile, snippet)
end
-- check flags for linker