Make external library no-op when used with incompatible target (#1941)

* tests: Add a test for C library in Vala target

https://github.com/mesonbuild/meson/issues/1939

* Make external library no-op when used with incompatible target

This is how it used to behave earlier, but we accidentally regressed

Closes https://github.com/mesonbuild/meson/issues/1939
pull/1953/head
Nirbheek Chauhan 8 years ago committed by Jussi Pakkanen
parent f1996f7291
commit 73c06780f9
  1. 5
      mesonbuild/dependencies/base.py
  2. 6
      test cases/vala/16 mixed dependence/meson.build

@ -528,7 +528,10 @@ class ExternalLibrary(ExternalDependency):
C-like code. Note that C++ libraries *can* be linked with C code with
a C++ linker (and vice-versa).
'''
if self.language == 'vala' and language != 'vala':
# Using a vala library in a non-vala target, or a non-vala library in a vala target
# XXX: This should be extended to other non-C linkers such as Rust
if (self.language == 'vala' and language != 'vala') or \
(language == 'vala' and self.language != 'vala'):
return []
return self.link_args

@ -1,6 +1,10 @@
project('mixed dependence', 'vala', 'c')
deps = [dependency('glib-2.0'), dependency('gobject-2.0')]
cc = meson.get_compiler('c')
deps = [dependency('glib-2.0'), dependency('gobject-2.0'),
# Should be ignored, see https://github.com/mesonbuild/meson/issues/1939
cc.find_library('z')]
mixer = static_library('mixer', 'mixer.vala', 'mixer-glue.c',
dependencies : deps)

Loading…
Cancel
Save