From cf488b53e48788b735a4da614e951bd424c677fc Mon Sep 17 00:00:00 2001 From: OpportunityLiu Date: Sat, 8 Aug 2020 18:56:23 +0800 Subject: check flags --- xmake/modules/detect/tools/nvcc/has_flags.lua | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/xmake/modules/detect/tools/nvcc/has_flags.lua b/xmake/modules/detect/tools/nvcc/has_flags.lua index 8cbffc010..0ab430b20 100644 --- a/xmake/modules/detect/tools/nvcc/has_flags.lua +++ b/xmake/modules/detect/tools/nvcc/has_flags.lua @@ -112,12 +112,19 @@ function _check_try_running(flags, opt, islinker) io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}") end - -- check flags - if islinker then - return _try_running(opt.program, table.join(flags, "-o", os.nuldev(), sourcefile)) - else - return _try_running(opt.program, table.join(flags, "-c", "-o", os.nuldev(), sourcefile)) + local args = table.join(flags, "-o", os.nuldev(), sourcefile) + + if not islinker then + table.insert(args, 2, "-c") + end + + local allow_unsupported_compiler = main("-allow-unsupported-compiler", opt) + if allow_unsupported_compiler then + table.insert(args, 1, "-allow-unsupported-compiler") end + + -- check flags + return _try_running(opt.program, args) end -- has_flags(flags)? -- cgit v1.3.1