aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/interpreter.py10
-rw-r--r--mesonbuild/optinterpreter.py7
2 files changed, 15 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,
diff --git a/mesonbuild/optinterpreter.py b/mesonbuild/optinterpreter.py
index 81f3177..2ba7b99 100644
--- a/mesonbuild/optinterpreter.py
+++ b/mesonbuild/optinterpreter.py
@@ -71,8 +71,15 @@ class OptionInterpreter:
def __init__(self, subproject, command_line_options):
self.options = {}
self.subproject = subproject
+ self.sbprefix = subproject + ':'
self.cmd_line_options = {}
for o in command_line_options:
+ if self.subproject != '': # Strip the beginning.
+ if not o.startswith(self.sbprefix):
+ continue
+ else:
+ if ':' in o:
+ continue
try:
(key, value) = o.split('=', 1)
except ValueError: