From 2fbc857ff4592b55acb8f4788d39c9f0fa0928dd Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 8 Oct 2017 17:11:29 +0300 Subject: [PATCH] Better error message when using external libraries incorrectly. Closes #2447. --- mesonbuild/build.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 9837d5a8d..2a71b8b4b 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -640,6 +640,12 @@ class BuildTarget(Target): # in kwargs. Unpack here without looking at the exact type. if hasattr(linktarget, "held_object"): linktarget = linktarget.held_object + if isinstance(linktarget, dependencies.ExternalLibrary): + raise MesonException('''An external library was used in link_with keyword argument, which +is reserved for libraries built as part of this project. External +libraries must be passed using the dependencies keyword argument +instead, because they are conceptually "external dependencies", +just like those detected with the dependency() function.''') self.link(linktarget) lwhole = extract_as_list(kwargs, 'link_whole') for linktarget in lwhole: