From a6df51aa8c2031aff181a2ad5bc5f0f5b60a44bb Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Thu, 10 Mar 2022 10:52:50 -0800 Subject: build: replace hand rolled code with CustomTarget[Index].links_dynamically() Which also fixes builds on windows that might produce a .lib instead of a .a. The error message has been changed to reflect that as well --- mesonbuild/build.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 550b5e4..d64b772 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -1418,8 +1418,8 @@ You probably should put it in link_with instead.''') if isinstance(t, (CustomTarget, CustomTargetIndex)): if not t.is_linkable_target(): raise InvalidArguments(f'Custom target {t!r} is not linkable.') - if not t.get_filename().endswith('.a'): - raise InvalidArguments('Can only link_whole custom targets that are .a archives.') + if t.links_dynamically(): + raise InvalidArguments('Can only link_whole custom targets that are static archives.') if isinstance(self, StaticLibrary): # FIXME: We could extract the .a archive to get object files raise InvalidArguments('Cannot link_whole a custom target into a static library') -- cgit v1.1