Passing --default-library=both should override project value

Looks like this has always been broken, had_argument_for() was checking
if we have --default_library instead of --default-library.
0.46
Xavier Claessens 7 years ago committed by Nirbheek Chauhan
parent ed831fc862
commit 73adac113e
  1. 2
      mesonbuild/environment.py
  2. 10
      run_unittests.py
  3. 4
      test cases/unit/30 command line/meson.build

@ -373,7 +373,7 @@ class Environment:
return is_library(fname)
def had_argument_for(self, option):
trial1 = '--' + option
trial1 = coredata.get_builtin_option_cmdline_name(option)
trial2 = '-D' + option
previous_is_plaind = False
for i in self.original_cmd_line_args:

@ -2026,6 +2026,7 @@ recommended as it can lead to undefined behaviour on some platforms''')
# Verify default values when passing no args
self.init(testdir)
obj = mesonbuild.coredata.load(self.builddir)
self.assertEqual(obj.builtins['default_library'].value, 'static')
self.assertEqual(obj.builtins['warning_level'].value, '1')
self.wipe()
@ -2059,6 +2060,15 @@ recommended as it can lead to undefined behaviour on some platforms''')
self.assertIn('passed as both', e.stderr)
self.wipe()
# --default-library should override default value from project()
self.init(testdir, extra_args=['--default-library=both'])
obj = mesonbuild.coredata.load(self.builddir)
self.assertEqual(obj.builtins['default_library'].value, 'both')
self.setconf('--default-library=shared')
obj = mesonbuild.coredata.load(self.builddir)
self.assertEqual(obj.builtins['default_library'].value, 'shared')
self.wipe()
class FailureTests(BasePlatformTests):
'''

@ -1 +1,3 @@
project('command line test', 'c')
project('command line test', 'c',
default_options : ['default_library=static']
)

Loading…
Cancel
Save