Skip to content

Commit f49bdd4

Browse files
sp1ritCSjpakkane
authored andcommitted
build: Also warn about header-only build targets
Build targets that do not contain any actual source files and only headers should just be as affected as build targets with no sources specified whatsoever, so the 'Build target has no sources.' warning should be thrown for them too.
1 parent e6384b0 commit f49bdd4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mesonbuild/build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,8 +758,8 @@ def __init__(
758758
self.link(link_targets)
759759
self.link_whole(link_whole_targets)
760760

761-
if not any([self.sources, self.generated, self.objects, self.link_whole_targets, self.structured_sources,
762-
kwargs.pop('_allow_no_sources', False)]):
761+
if not any([[src for src in self.sources if not is_header(src)], self.generated, self.objects,
762+
self.link_whole_targets, self.structured_sources, kwargs.pop('_allow_no_sources', False)]):
763763
mlog.warning(f'Build target {name} has no sources. '
764764
'This was never supposed to be allowed but did because of a bug, '
765765
'support will be removed in a future release of Meson')

0 commit comments

Comments
 (0)