diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 8197b5e31..7641514d0 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -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: diff --git a/test cases/failing/61 getoption prefix/meson.build b/test cases/failing/61 getoption prefix/meson.build new file mode 100644 index 000000000..8f85cff2a --- /dev/null +++ b/test cases/failing/61 getoption prefix/meson.build @@ -0,0 +1,5 @@ +project('getopt prefix') + +subproject('abc') + +get_option('abc:foo') diff --git a/test cases/failing/61 getoption prefix/subprojects/abc/meson.build b/test cases/failing/61 getoption prefix/subprojects/abc/meson.build new file mode 100644 index 000000000..aa9c3df0f --- /dev/null +++ b/test cases/failing/61 getoption prefix/subprojects/abc/meson.build @@ -0,0 +1 @@ +project('abc', 'c') diff --git a/test cases/failing/61 getoption prefix/subprojects/abc/meson_options.txt b/test cases/failing/61 getoption prefix/subprojects/abc/meson_options.txt new file mode 100644 index 000000000..89e624e24 --- /dev/null +++ b/test cases/failing/61 getoption prefix/subprojects/abc/meson_options.txt @@ -0,0 +1 @@ +option('foo', type : 'boolean')