diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2025-12-17 09:56:02 -0800 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2025-12-17 14:04:17 -0800 |
| commit | 6e4caca1dacd62b86967c0aa9f5a64e95f356e39 (patch) | |
| tree | be2037997d0bfd1a8e69cd159de330cf8158ff7b | |
| parent | 404139d72a3fba77bbc3d4c4d6549b542694dfa0 (diff) | |
| download | meson-6e4caca1dacd62b86967c0aa9f5a64e95f356e39.tar.gz | |
interpreter: validate that a target is linkable in link_whole check
This catches the addition of un-linkable targets at the interpreter
level rather than requiring the build layer to handle this. In turn,
this gives the end user a better error message.
| -rw-r--r-- | mesonbuild/interpreter/type_checking.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mesonbuild/interpreter/type_checking.py b/mesonbuild/interpreter/type_checking.py index 259b55f75..2d9f2a11e 100644 --- a/mesonbuild/interpreter/type_checking.py +++ b/mesonbuild/interpreter/type_checking.py @@ -449,10 +449,12 @@ LINK_WITH_KW: KwargInfo[T.List[T.Union[BothLibraries, SharedLibrary, StaticLibra extra_types={Dependency: lambda _: _LINK_WITH_ERROR} ) -def link_whole_validator(values: T.List[T.Union[StaticLibrary, CustomTarget, CustomTargetIndex, Dependency]]) -> T.Optional[str]: +def link_whole_validator(values: T.List[T.Union[StaticLibrary, CustomTarget, CustomTargetIndex]]) -> T.Optional[str]: for l in values: if isinstance(l, (CustomTarget, CustomTargetIndex)) and l.links_dynamically(): return f'{type(l).__name__} returning a shared library is not allowed' + if not l.is_linkable_target(): + return f'Link target "{l!s}" is not linkable' return None LINK_WHOLE_KW: KwargInfo[T.List[T.Union[BothLibraries, StaticLibrary, CustomTarget, CustomTargetIndex]]] = KwargInfo( |
