summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/modules/core/tools/cl.lua22
1 files changed, 13 insertions, 9 deletions
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index 506f9e6d7..177b97669 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -158,15 +158,19 @@ end
-- make the optimize flag
function nf_optimize(self, level)
- local maps =
- {
- none = "-Od"
- , faster = "-O2"
- , fastest = "-Ox -fp:fast"
- , smallest = "-O1 -GL" -- /GL and (/OPT:REF is on by default in linker), we need enable /ltcg
- , aggressive = "-Ox -fp:fast"
- }
- return maps[level]
+ -- only for source kind
+ local kind = self:kind()
+ if language.sourcekinds()[kind] then
+ local maps =
+ {
+ none = "-Od"
+ , faster = "-Ox"
+ , fastest = "-O2 -fp:fast"
+ , smallest = "-O1 -GL" -- /GL and (/OPT:REF is on by default in linker), we need enable /ltcg
+ , aggressive = "-O2 -fp:fast"
+ }
+ return maps[level]
+ end
end
-- make vs runtime flag