diff options
Diffstat (limited to 'xmake/modules/core/tools/clang.lua')
| -rw-r--r-- | xmake/modules/core/tools/clang.lua | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/xmake/modules/core/tools/clang.lua b/xmake/modules/core/tools/clang.lua index e5734a953..ef0a379da 100644 --- a/xmake/modules/core/tools/clang.lua +++ b/xmake/modules/core/tools/clang.lua @@ -20,6 +20,7 @@ -- inherit gcc inherit("gcc") +import("core.language.language") -- init it function init(self) @@ -98,16 +99,20 @@ end -- make the optimize flag function nf_optimize(self, level) - local maps = - { - none = "-O0" - , fast = "-O1" - , faster = "-O2" - , fastest = "-O3" - , smallest = "-Oz" -- smaller than -Os - , aggressive = "-Ofast" - } - return maps[level] + -- only for source kind + local kind = self:kind() + if language.sourcekinds()[kind] then + local maps = + { + none = "-O0" + , fast = "-O1" + , faster = "-O2" + , fastest = "-O3" + , smallest = "-Oz" -- smaller than -Os + , aggressive = "-Ofast" + } + return maps[level] + end end -- make the warning flag |
