Prevent projects from grabbing other projects' options.

This commit is contained in:
Jussi Pakkanen 2017-09-29 21:33:31 +03:00
parent 7d49d1d2d7
commit 1b442d11b4
4 changed files with 10 additions and 0 deletions

View File

@ -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:

View File

@ -0,0 +1,5 @@
project('getopt prefix')
subproject('abc')
get_option('abc:foo')

View File

@ -0,0 +1 @@
project('abc', 'c')

View File

@ -0,0 +1 @@
option('foo', type : 'boolean')