From c7e367ac161d1b7faead7e2de99072ca135d0df8 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Fri, 4 Sep 2015 23:31:32 +0300 Subject: Can set default warning with an envvar. --- meson.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'meson.py') diff --git a/meson.py b/meson.py index 8f08e6a..a17c377 100755 --- a/meson.py +++ b/meson.py @@ -30,6 +30,14 @@ backendlist = ['ninja', 'vs2010', 'xcode'] build_types = ['plain', 'debug', 'debugoptimized', 'release'] warning_levels = ['1', '2', '3'] +default_warning = '1' +try: + warn_candidate = os.environ['MESON_WARN_LEVEL'] + if warn_candidate in warning_levels: + default_warning = warn_candidate +except KeyError: + pass + if mesonlib.is_windows(): def_prefix = 'c:/' else: @@ -63,8 +71,8 @@ parser.add_argument('--unity', action='store_true', dest='unity', default=False, help='unity build') parser.add_argument('--werror', action='store_true', dest='werror', default=False,\ help='Treat warnings as errors') -parser.add_argument('--warnlevel', default='1', dest='warning_level', choices=warning_levels,\ - help='Level of compiler warnings to use (larger is more)') +parser.add_argument('--warnlevel', default=default_warning, dest='warning_level', choices=warning_levels,\ + help='Level of compiler warnings to use (larger is more, default is %(default)s)') parser.add_argument('--cross-file', default=None, dest='cross_file', help='file describing cross compilation environment') parser.add_argument('-D', action='append', dest='projectoptions', default=[], -- cgit v1.1