diff options
-rw-r--r-- | interpreter.py | 4 | ||||
-rw-r--r-- | test cases/common/49 subproject/meson.build | 4 | ||||
-rw-r--r-- | test cases/common/49 subproject/sublib/meson.build | 4 |
3 files changed, 12 insertions, 0 deletions
diff --git a/interpreter.py b/interpreter.py index 3ce1feb..e655697 100644 --- a/interpreter.py +++ b/interpreter.py @@ -614,6 +614,7 @@ class Interpreter(): 'option' : self.func_option, 'get_option' : self.func_get_option, 'subproject' : self.func_subproject, + 'is_subproject' : self.func_is_subproject, } def get_build_def_files(self): @@ -730,6 +731,9 @@ class Interpreter(): def func_option(self, nodes, args, kwargs): raise InterpreterException('Tried to call option() in build description file. All options must be in the option file.') + def func_is_subproject(self, nodes, args, kwargs): + return self.subproject != '' + def func_subproject(self, nodes, args, kwargs): if len(args) != 1: raise InterpreterException('Subproject takes exactly one argument') diff --git a/test cases/common/49 subproject/meson.build b/test cases/common/49 subproject/meson.build index e7054c5..143c4bc 100644 --- a/test cases/common/49 subproject/meson.build +++ b/test cases/common/49 subproject/meson.build @@ -2,6 +2,10 @@ project('subproj user', 'c') sub = subproject('sublib') +if is_subproject() + error('Claimed to be a subproject even though we are the master project.') +endif + inc = sub.get_variable('i') lib = sub.get_variable('l') diff --git a/test cases/common/49 subproject/sublib/meson.build b/test cases/common/49 subproject/sublib/meson.build index 9ff3111..3b6ad7d 100644 --- a/test cases/common/49 subproject/sublib/meson.build +++ b/test cases/common/49 subproject/sublib/meson.build @@ -1,5 +1,9 @@ project('subproject', 'c') +if not is_subproject() + error('Claimed to be master project even though we are a subproject.') +endif + i = include_directories('include') l = shared_library('sublib', 'sublib.c', include_dirs : i, install : true) t = executable('simpletest', 'simpletest.c', include_dirs : i, link_with : l) |