summaryrefslogtreecommitdiff
path: root/xmake/modules/detect
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2020-08-10 00:59:02 +0800
committerOpportunityLiu <[email protected]>2020-08-10 00:59:02 +0800
commit084e01a6ac7961fa650aba9cdc06502e4bd88b2c (patch)
tree80e9d30630ca99b9ff094aa6049cac23de5796be /xmake/modules/detect
parent052278ef2744328d6e6d1b2620bdbbf343540708 (diff)
fix code style
Diffstat (limited to 'xmake/modules/detect')
-rw-r--r--xmake/modules/detect/tools/nvcc/has_flags.lua11
1 files 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
+