summaryrefslogtreecommitdiff
path: root/xmake/modules/detect/tools/nvcc/has_flags.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2023-02-15 22:46:13 +0800
committerruki <[email protected]>2023-02-15 22:46:13 +0800
commite288951c41b72f3ccf3cfed495417fea7dee1e79 (patch)
tree085099794d03376e60680ae594697a3669f6fbf5 /xmake/modules/detect/tools/nvcc/has_flags.lua
parent0936ad49411c55cf4130793750336e011366ebbf (diff)
add snippet to has_flags
Diffstat (limited to 'xmake/modules/detect/tools/nvcc/has_flags.lua')
-rw-r--r--xmake/modules/detect/tools/nvcc/has_flags.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/xmake/modules/detect/tools/nvcc/has_flags.lua b/xmake/modules/detect/tools/nvcc/has_flags.lua
index d96ffdfe8..c75f6e114 100644
--- a/xmake/modules/detect/tools/nvcc/has_flags.lua
+++ b/xmake/modules/detect/tools/nvcc/has_flags.lua
@@ -101,13 +101,13 @@ end
function _check_try_running(flags, opt, islinker)
-- make an stub source file
- local sourcefile = path.join(os.tmpdir(), "detect", "nvcc_has_flags.cu")
+ local snippet = opt.snippet or "int main(int argc, char** argv)\n{return 0;}"
+ local sourcefile = os.tmpfile("nvcc_has_flags:" .. snippet) .. ".cu"
if not os.isfile(sourcefile) then
- io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}")
+ io.writefile(sourcefile, snippet)
end
local args = table.join("-o", os.nuldev(), sourcefile)
-
if not islinker then
table.insert(args, 1, "-c")
end