diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 2a71b8b4b..2840f2984 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -863,6 +863,8 @@ You probably should put it in link_with instead.''') def link(self, target): for t in listify(target, unholder=True): + if not isinstance(t, Target): + raise InvalidArguments('{!r} is not a target.'.format(t)) if not t.is_linkable_target(): raise InvalidArguments('Link target {!r} is not linkable.'.format(t)) if isinstance(self, SharedLibrary) and isinstance(t, StaticLibrary) and not t.pic: diff --git a/test cases/failing/66 string as link target/meson.build b/test cases/failing/66 string as link target/meson.build new file mode 100644 index 000000000..cb83fff6a --- /dev/null +++ b/test cases/failing/66 string as link target/meson.build @@ -0,0 +1,2 @@ +project('string as link argument', 'c') +executable('myprog', 'prog.c', link_with: [ '' ]) diff --git a/test cases/failing/66 string as link target/prog.c b/test cases/failing/66 string as link target/prog.c new file mode 100644 index 000000000..0314ff17b --- /dev/null +++ b/test cases/failing/66 string as link target/prog.c @@ -0,0 +1 @@ +int main(int argc, char **argv) { return 0; }