diff --git a/src/tools/gcc.lua b/src/tools/gcc.lua index 190c8af0..ffda8d60 100644 --- a/src/tools/gcc.lua +++ b/src/tools/gcc.lua @@ -106,21 +106,21 @@ -- gcc.cxxflags = { + exceptionhandling = { + Off = "-fno-exceptions" + }, flags = { NoBufferSecurityCheck = "-fno-stack-protector", ["C++11"] = "-std=c++11", ["C++14"] = "-std=c++14", + }, + rtti = { + Off = "-fno-rtti" } } function gcc.getcxxflags(cfg) local flags = config.mapFlags(cfg, gcc.cxxflags) - if cfg.exceptionhandling == p.OFF then - table.insert(flags, '-fno-exceptions') - end - if cfg.rtti == p.OFF then - table.insert(flags, '-fno-rtti') - end return flags end diff --git a/src/tools/msc.lua b/src/tools/msc.lua index 0a0712a4..5226d125 100644 --- a/src/tools/msc.lua +++ b/src/tools/msc.lua @@ -7,10 +7,12 @@ --- - premake.tools.msc = {} - local msc = premake.tools.msc - local project = premake.project - local config = premake.config + local p = premake + + p.tools.msc = {} + local msc = p.tools.msc + local project = p.project + local config = p.config -- @@ -103,19 +105,17 @@ -- Returns list of C++ compiler flags for a configuration. -- + msc.cxxflags = { + rtti = { + Off = "/GR-" + } + } + function msc.getcxxflags(cfg) - local flags = {} + local flags = config.mapFlags(cfg, msc.cxxflags) - if cfg.rtti == premake.OFF then - table.insert(flags, "/GR-") - end - - if cfg.exceptionhandling == premake.ON or cfg.flags.SEH then - if cfg.flags.SEH then - table.insert(flags, "/EHa") - else - table.insert(flags, "/EHsc") - end + if not cfg.flags.SEH and cfg.exceptionhandling ~= p.OFF then + table.insert(flags, "/EHsc") end return flags