aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian "sp1rit"​ <sp1rit@disroot.org>2025-07-27 10:08:55 +0200
committerJussi Pakkanen <jussi.pakkanen@mailbox.org>2025-08-10 22:38:30 +0300
commitf49bdd473ca063c9e928c2e96bdb30582d2129bf (patch)
tree8d12ec728e219aadcb1ead75da7821108f34e29a
parente6384b088a014f309b82b120db0badd7d8b8bb0e (diff)
downloadmeson-f49bdd473ca063c9e928c2e96bdb30582d2129bf.zip
meson-f49bdd473ca063c9e928c2e96bdb30582d2129bf.tar.gz
meson-f49bdd473ca063c9e928c2e96bdb30582d2129bf.tar.bz2
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.
-rw-r--r--mesonbuild/build.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 83c65b6..041cb19 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -758,8 +758,8 @@ class BuildTarget(Target):
self.link(link_targets)
self.link_whole(link_whole_targets)
- if not any([self.sources, self.generated, self.objects, self.link_whole_targets, self.structured_sources,
- kwargs.pop('_allow_no_sources', False)]):
+ if not any([[src for src in self.sources if not is_header(src)], self.generated, self.objects,
+ self.link_whole_targets, self.structured_sources, kwargs.pop('_allow_no_sources', False)]):
mlog.warning(f'Build target {name} has no sources. '
'This was never supposed to be allowed but did because of a bug, '
'support will be removed in a future release of Meson')