summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2019-05-21 10:46:29 +0800
committerOpportunityLiu <[email protected]>2019-05-21 10:46:29 +0800
commit840280ab9f9abcfc5c8c4dbad9e3165b2a4a34f0 (patch)
tree9d927cb79d4932885b030103776246353f1586f5
parentef310a63e8b7d27cc785793b83f0f688711d5305 (diff)
check corrcet warnig flags
-rw-r--r--xmake/modules/core/tools/nvcc.lua18
1 files changed, 14 insertions, 4 deletions
diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua
index 7698b6f8f..907703b6f 100644
--- a/xmake/modules/core/tools/nvcc.lua
+++ b/xmake/modules/core/tools/nvcc.lua
@@ -107,14 +107,24 @@ function nf_warning(self, level)
, error = "-Werror"
}
- local warning = maps[level]
+ local warning = maps[level] or ""
+
+ local host_warning = nil
-- for cl.exe on windows, it is the only supported host compiler on the platform
if is_plat("windows") then
- warning = warning .. ' -Xcompiler "' .. cl_maps[level] .. '"'
+ host_warning = cl_maps[level]
-- for gcc/clang, or any gnu compatible compiler on *nix
- elseif self:has_flags("-Xcompiler -Wall", "cxflags") then
- warning = warning .. ' -Xcompiler "' .. gcc_clang_maps[level] .. '"'
+ else
+ local gcc_clang_warning = gcc_clang_maps[level]
+ if gcc_clang_warning and self:has_flags(' -Xcompiler "' .. gcc_clang_warning .. '"', "cxflags") then
+ host_warning = gcc_clang_warning
+ end
end
+
+ if host_warning then
+ warning = warning .. ' -Xcompiler "' .. host_warning .. '"'
+ end
+
return warning
end