summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2019-05-21 10:50:25 +0800
committerOpportunityLiu <[email protected]>2019-05-21 10:50:25 +0800
commit43380eb2e3a4771d9ae43b905021c1a2810bf0eb (patch)
tree26e58bed06086221b705de84f05eb07480e6e4e2
parent840280ab9f9abcfc5c8c4dbad9e3165b2a4a34f0 (diff)
return nil for no flags
-rw-r--r--xmake/modules/core/tools/nvcc.lua16
1 files changed, 10 insertions, 6 deletions
diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua
index 907703b6f..943a060d3 100644
--- a/xmake/modules/core/tools/nvcc.lua
+++ b/xmake/modules/core/tools/nvcc.lua
@@ -107,8 +107,8 @@ function nf_warning(self, level)
, error = "-Werror"
}
- local warning = maps[level] or ""
-
+ local warning = maps[level]
+
local host_warning = nil
-- for cl.exe on windows, it is the only supported host compiler on the platform
if is_plat("windows") then
@@ -121,11 +121,15 @@ function nf_warning(self, level)
end
end
- if host_warning then
- warning = warning .. ' -Xcompiler "' .. host_warning .. '"'
+ if warning and host_warning then
+ return warning .. ' -Xcompiler "' .. host_warning .. '"'
+ elseif warning then
+ return warning
+ elseif host_warning then
+ return '-Xcompiler "' .. host_warning .. '"'
+ else
+ return nil
end
-
- return warning
end
-- make the optimize flag