interpreter: Add link_language to all build targets

If the feature hadn't been broken in the first place it would have
worked on them anyway, so we might as well expose it. I'm loathe to do
it because one of the best features of meson in a mixed C/C++ code base
is that meson figures out the right linker every time, but there are
cases people have where they want to force a linker. We'll let them keep
the pieces.
pull/6838/head
Dylan Baker 5 years ago
parent d8a3c777a6
commit fdd6022530
  1. 3
      mesonbuild/build.py
  2. 3
      run_unittests.py
  3. 5
      test cases/common/232 link language/lib.cpp
  4. 6
      test cases/common/232 link language/meson.build

@ -82,6 +82,7 @@ buildtarget_kwargs = set([
'override_options',
'sources',
'gnu_symbol_visibility',
'link_language',
])
known_build_target_kwargs = (
@ -92,7 +93,7 @@ known_build_target_kwargs = (
rust_kwargs |
cs_kwargs)
known_exe_kwargs = known_build_target_kwargs | {'implib', 'export_dynamic', 'link_language', 'pie'}
known_exe_kwargs = known_build_target_kwargs | {'implib', 'export_dynamic', 'pie'}
known_shlib_kwargs = known_build_target_kwargs | {'version', 'soversion', 'vs_module_defs', 'darwin_versions'}
known_shmod_kwargs = known_build_target_kwargs | {'vs_module_defs'}
known_stlib_kwargs = known_build_target_kwargs | {'pic'}

@ -4647,7 +4647,7 @@ recommended as it is not supported on some platforms''')
if self.backend is not Backend.ninja:
raise unittest.SkipTest('This test reads the ninja file')
testdir = os.path.join(self.common_test_dir, '230 link language')
testdir = os.path.join(self.common_test_dir, '232 link language')
self.init(testdir)
build_ninja = os.path.join(self.builddir, 'build.ninja')
@ -4655,6 +4655,7 @@ recommended as it is not supported on some platforms''')
contents = f.read()
self.assertRegex(contents, r'build main(\.exe)?.*: c_LINKER')
self.assertRegex(contents, r'build (lib|cyg)?mylib.*: c_LINKER')
class FailureTests(BasePlatformTests):

@ -0,0 +1,5 @@
extern "C" {
int makeInt(void) {
return 1;
}
}

@ -9,4 +9,10 @@ exe = executable(
link_language : 'c',
)
lib = library(
'mylib',
['lib.cpp'],
link_language : 'c',
)
test('main', exe)

Loading…
Cancel
Save