diff options
| -rw-r--r-- | xmake/modules/core/tools/clang.lua | 22 | ||||
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 11 |
2 files changed, 23 insertions, 10 deletions
diff --git a/xmake/modules/core/tools/clang.lua b/xmake/modules/core/tools/clang.lua index 08822e367..521f31361 100644 --- a/xmake/modules/core/tools/clang.lua +++ b/xmake/modules/core/tools/clang.lua @@ -142,3 +142,25 @@ function nf_symbol(self, level) return _super.nf_symbol(self, level) end end + +-- make the exception flag +-- +-- e.g. +-- set_exceptions("cxx") +-- set_exceptions("objc") +-- set_exceptions("no-cxx") +-- set_exceptions("no-objc") +-- set_exceptions("cxx", "objc") +function nf_exception(self, exp) + local maps = { + cxx = "-fcxx-exceptions", + ["no-cxx"] = "-fno-cxx-exceptions", + objc = "-fobjc-exceptions", + ["no-objc"] = "-fno-objc-exceptions" + } + local value = maps[exp] + if value then + return {exp:startswith("no-") and "-fno-exceptions" or "-fexceptions", value} + end +end + diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index cd11743c7..412a0cdbf 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -311,16 +311,7 @@ end -- set_exceptions("no-objc") -- set_exceptions("cxx", "objc") function nf_exception(self, exp) - local maps = { - cxx = "-fcxx-exceptions", - ["no-cxx"] = "-fno-cxx-exceptions", - objc = "-fobjc-exceptions", - ["no-objc"] = "-fno-objc-exceptions" - } - local value = maps[exp] - if value then - return {exp:startswith("no-") and "-fno-exceptions" or "-fexceptions", value} - end + return exp:startswith("no-") and "-fno-exceptions" or "-fexceptions" end -- make the c precompiled header flag |
