aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index db2c309..9d55bf9 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -777,12 +777,11 @@ class BuildTarget(Target):
for s in objects:
if isinstance(s, (str, File, ExtractedObjects)):
self.objects.append(s)
- elif isinstance(s, (GeneratedList, CustomTarget)):
- msg = 'Generated files are not allowed in the \'objects\' kwarg ' + \
- f'for target {self.name!r}.\nIt is meant only for ' + \
- 'pre-built object files that are shipped with the\nsource ' + \
- 'tree. Try adding it in the list of sources.'
- raise InvalidArguments(msg)
+ elif isinstance(s, (CustomTarget, CustomTargetIndex, GeneratedList)):
+ non_objects = [o for o in s.get_outputs() if not is_object(o)]
+ if non_objects:
+ raise InvalidArguments(f'Generated file {non_objects[0]} in the \'objects\' kwarg is not an object.')
+ self.generated.append(s)
else:
raise InvalidArguments(f'Bad object of type {type(s).__name__!r} in target {self.name!r}.')