Prevent projects from grabbing other projects' options.
This commit is contained in:
parent
7d49d1d2d7
commit
1b442d11b4
|
@ -1700,6 +1700,9 @@ class Interpreter(InterpreterBase):
|
|||
if len(args) != 1:
|
||||
raise InterpreterException('Argument required for get_option.')
|
||||
optname = args[0]
|
||||
if ':' in optname:
|
||||
raise InterpreterException('''Having a colon in option name is forbidden, projects are not allowed
|
||||
to directly access options of other subprojects.''')
|
||||
try:
|
||||
return self.environment.get_coredata().base_options[optname].value
|
||||
except KeyError:
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
project('getopt prefix')
|
||||
|
||||
subproject('abc')
|
||||
|
||||
get_option('abc:foo')
|
|
@ -0,0 +1 @@
|
|||
project('abc', 'c')
|
|
@ -0,0 +1 @@
|
|||
option('foo', type : 'boolean')
|
Loading…
Reference in New Issue