diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2016-12-29 19:30:58 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2016-12-29 19:30:58 +0200 |
commit | 73042c79124f529eb8f08a25d2877b8ceebd4c22 (patch) | |
tree | fbd24b9eef77f400e4c5f499cfb316b4551a072c /mesonbuild/interpreter.py | |
parent | f85c348b948c9ecd9a5ec60d0c529b80e0c01a81 (diff) | |
download | meson-73042c79124f529eb8f08a25d2877b8ceebd4c22.zip meson-73042c79124f529eb8f08a25d2877b8ceebd4c22.tar.gz meson-73042c79124f529eb8f08a25d2877b8ceebd4c22.tar.bz2 |
Can set project options (but not global options) in subproject default options.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r-- | mesonbuild/interpreter.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 4f3f81a..b889aa0 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1483,19 +1483,25 @@ class Interpreter(InterpreterBase): raise InterpreterException('All default options must be of type key=value.') key, value = option.split('=', 1) if coredata.is_builtin_option(key): + if self.subproject != '': + continue # Only the master project is allowed to set global options. if not self.environment.had_argument_for(key): self.coredata.set_builtin_option(key, value) # If this was set on the command line, do not override. else: + # If we are in a subproject, add the subproject prefix to option + # name. + if self.subproject != '': + option = self.subproject + ':' + option newoptions = [option] + self.environment.cmd_line_options.projectoptions self.environment.cmd_line_options.projectoptions = newoptions @stringArgs def func_project(self, node, args, kwargs): + if self.environment.first_invocation and 'default_options' in kwargs: + self.parse_default_options(kwargs['default_options']) if not self.is_subproject(): self.build.project_name = args[0] - if self.environment.first_invocation and 'default_options' in kwargs: - self.parse_default_options(kwargs['default_options']) if os.path.exists(self.option_file): oi = optinterpreter.OptionInterpreter(self.subproject, \ self.build.environment.cmd_line_options.projectoptions, |