From 084e01a6ac7961fa650aba9cdc06502e4bd88b2c Mon Sep 17 00:00:00 2001 From: OpportunityLiu Date: Mon, 10 Aug 2020 00:59:02 +0800 Subject: fix code style --- xmake/modules/detect/tools/nvcc/has_flags.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/xmake/modules/detect/tools/nvcc/has_flags.lua b/xmake/modules/detect/tools/nvcc/has_flags.lua index 40ec2e504..2929f67bd 100644 --- a/xmake/modules/detect/tools/nvcc/has_flags.lua +++ b/xmake/modules/detect/tools/nvcc/has_flags.lua @@ -118,8 +118,11 @@ function _check_try_running(flags, opt, islinker) table.insert(args, 1, "-c") end + -- avoid recursion if flags[1] ~= "-allow-unsupported-compiler" then - local allow_unsupported_compiler = main({"-allow-unsupported-compiler"}, opt) + -- add -allow-unsupported-compiler if supported to suppress error of unsupported compiler, + -- which caused all checks failed. + local allow_unsupported_compiler = _has_flags({"-allow-unsupported-compiler"}, opt) if allow_unsupported_compiler then table.insert(args, 1, "-allow-unsupported-compiler") end @@ -135,7 +138,7 @@ end -- -- @return true or false -- -function main(flags, opt) +function _has_flags(flags, opt) -- is linker? local islinker = _islinker(flags, opt) @@ -149,3 +152,7 @@ function main(flags, opt) return _check_try_running(flags, opt, islinker) end +function main(...) + return _has_flags(...) +end + -- cgit v1.3.1