diff options
-rw-r--r-- | interpreter.py | 8 | ||||
-rw-r--r-- | test cases/common/49 subproject/meson.build | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/interpreter.py b/interpreter.py index 4e7dae9..61f5938 100644 --- a/interpreter.py +++ b/interpreter.py @@ -730,6 +730,8 @@ class Interpreter(): dirname = args[0] if not isinstance(dirname, str): raise InterpreterException('Subproject argument must be a string') + if self.subdir != '': + raise InterpreterException('Subprojects must be defined at the root directory.') if self.subproject != '': raise InterpreterException('Subprojects of subprojects are not yet supported.') if dirname in self.subprojects: @@ -985,7 +987,8 @@ class Interpreter(): for a in args: if not isinstance(a, str): raise InvalidArguments('Argument %s is not a string.' % str(a)) - i = IncludeDirsHolder(self.subdir, args, kwargs) + curdir = os.path.join(self.subproject, self.subdir) + i = IncludeDirsHolder(curdir, args, kwargs) return i def func_add_global_arguments(self, node, args, kwargs): @@ -1047,7 +1050,8 @@ class Interpreter(): if name in self.build.targets: raise InvalidCode('Tried to create target "%s", but a target of that name already exists.' % name) self.check_sources_exist(os.path.join(self.source_root, self.subdir), sources) - l = targetclass(name, self.subdir, is_cross, sources, objs, self.environment, kwargs) + full_subdir = os.path.join(self.subproject, self.subdir) + l = targetclass(name, full_subdir, is_cross, sources, objs, self.environment, kwargs) self.build.targets[name] = l.held_object if self.environment.is_cross_build() and l.is_cross: txt = ' cross build ' diff --git a/test cases/common/49 subproject/meson.build b/test cases/common/49 subproject/meson.build index 18531f5..e7054c5 100644 --- a/test cases/common/49 subproject/meson.build +++ b/test cases/common/49 subproject/meson.build @@ -5,5 +5,5 @@ sub = subproject('sublib') inc = sub.get_variable('i') lib = sub.get_variable('l') -e = executable('user', 'user.c', include_dirs : inc, link_with : lib) +e = executable('user', 'user.c', include_dirs : inc, link_with : lib, install : true) test('subdirtest', e) |