SCons: Add 'werror' opt-in to treat warning as errors

Also reorder advanced options to a more natural order,
and fix MSVC warning when disabling warnings in secondary environment.
This commit is contained in:
Rémi Verschelde
2018-10-03 13:38:09 +02:00
parent 0e2de7481d
commit 2024666305
2 changed files with 19 additions and 9 deletions

View File

@ -22,6 +22,10 @@ def add_source_files(self, sources, filetype, lib_env=None, shared=False):
def disable_warnings(self):
# 'self' is the environment
if self.msvc:
# We have to remove existing warning level defines before appending /w,
# otherwise we get: "warning D9025 : overriding '/W3' with '/w'"
warn_flags = ['/Wall', '/W4', '/W3', '/W2', '/W1', '/WX']
self['CCFLAGS'] = [x for x in self['CCFLAGS'] if not x in warn_flags]
self.Append(CCFLAGS=['/w'])
else:
self.Append(CCFLAGS=['-w'])