summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2020-08-08 19:13:42 +0800
committerOpportunityLiu <[email protected]>2020-08-08 19:13:42 +0800
commit42034f35e7dba6d680ad82ab326b9dc95f3e41ba (patch)
treea1a05208504d76209defc061da0530fc4bf196cc
parentcf488b53e48788b735a4da614e951bd424c677fc (diff)
fix has_flags
-rw-r--r--xmake/modules/detect/tools/nvcc/has_flags.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/xmake/modules/detect/tools/nvcc/has_flags.lua b/xmake/modules/detect/tools/nvcc/has_flags.lua
index 0ab430b20..40ec2e504 100644
--- a/xmake/modules/detect/tools/nvcc/has_flags.lua
+++ b/xmake/modules/detect/tools/nvcc/has_flags.lua
@@ -112,19 +112,21 @@ function _check_try_running(flags, opt, islinker)
io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}")
end
- local args = table.join(flags, "-o", os.nuldev(), sourcefile)
+ local args = table.join("-o", os.nuldev(), sourcefile)
if not islinker then
- table.insert(args, 2, "-c")
+ table.insert(args, 1, "-c")
end
- local allow_unsupported_compiler = main("-allow-unsupported-compiler", opt)
- if allow_unsupported_compiler then
- table.insert(args, 1, "-allow-unsupported-compiler")
+ if flags[1] ~= "-allow-unsupported-compiler" then
+ local allow_unsupported_compiler = main({"-allow-unsupported-compiler"}, opt)
+ if allow_unsupported_compiler then
+ table.insert(args, 1, "-allow-unsupported-compiler")
+ end
end
-- check flags
- return _try_running(opt.program, args)
+ return _try_running(opt.program, table.join(flags, args))
end
-- has_flags(flags)?