do better sanity check for vs_module_defs input

We allow custom_target() but check for it based on hasattr, ever since
the initial implementation way back in the day, in commit
66a6ea984b. This is a bit broken because
various objects might support that but still aren't supposed to work. We
can actually just use isintance checks like we do immediately above,
which are more accurate and avoid crashes on things that aren't even
targets at all, like run_target(). Although custom_target indexes are
actually targets those didn't work either.

Fixes #9648
pull/12055/head
Eli Schwartz 1 year ago committed by Dylan Baker
parent 1cd16a7cc5
commit 404312c6dd
  1. 2
      mesonbuild/build.py

@ -2383,7 +2383,7 @@ class SharedLibrary(BuildTarget):
elif isinstance(path, File):
# When passing a generated file.
self.vs_module_defs = path
elif hasattr(path, 'get_filename'):
elif isinstance(path, CustomTarget):
# When passing output of a Custom Target
self.vs_module_defs = File.from_built_file(path.subdir, path.get_filename())
else:

Loading…
Cancel
Save