diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2018-06-07 23:41:17 -0400 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2018-06-09 18:10:23 +0000 |
commit | 18e25b67737fa27ba38ee293718dc9ca40c81a43 (patch) | |
tree | 8ce2efd624d7c56997daf2805f83183385a70302 /mesonbuild/interpreter.py | |
parent | 2e34024a05ef7d38e24781513d04eab8fb30f882 (diff) | |
download | meson-18e25b67737fa27ba38ee293718dc9ca40c81a43.zip meson-18e25b67737fa27ba38ee293718dc9ca40c81a43.tar.gz meson-18e25b67737fa27ba38ee293718dc9ca40c81a43.tar.bz2 |
Fix options being reset to default on reconfigure
Closes: #3712
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r-- | mesonbuild/interpreter.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index a58e57d..1e225da 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -2269,7 +2269,10 @@ to directly access options of other subprojects.''') else: raise InterpreterException('Unknown backend "%s".' % backend) - self.coredata.init_backend_options(backend) + # Only init backend options on first invocation otherwise it would + # override values previously set from command line. + if self.environment.first_invocation: + self.coredata.init_backend_options(backend) options = {k: v for k, v in self.environment.cmd_line_options.items() if k.startswith('backend_')} self.coredata.set_options(options) @@ -2289,9 +2292,16 @@ to directly access options of other subprojects.''') oi.process(self.option_file) self.coredata.merge_user_options(oi.options) - default_options = mesonlib.stringlistify(kwargs.get('default_options', [])) - default_options = coredata.create_options_dict(default_options) - default_options.update(self.default_project_options) + # Do not set default_options on reconfigure otherwise it would override + # values previously set from command line. That means that changing + # default_options in a project will trigger a reconfigure but won't + # have any effect. + if self.environment.first_invocation: + default_options = mesonlib.stringlistify(kwargs.get('default_options', [])) + default_options = coredata.create_options_dict(default_options) + default_options.update(self.default_project_options) + else: + default_options = {} self.set_options(default_options) self.set_backend() |