diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2020-03-24 12:02:14 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2020-04-30 10:38:55 -0700 |
commit | d8a3c777a62b18d33bbdbca0fd4954399e1ebc04 (patch) | |
tree | b6919ad1fff1f215f2e62378bc004234270ac90f /mesonbuild/build.py | |
parent | 650023f0ccfe2ff8ed8134ab3b26d50c891b0f74 (diff) | |
download | meson-d8a3c777a62b18d33bbdbca0fd4954399e1ebc04.zip meson-d8a3c777a62b18d33bbdbca0fd4954399e1ebc04.tar.gz meson-d8a3c777a62b18d33bbdbca0fd4954399e1ebc04.tar.bz2 |
build: Fix link_language selection
Currently it does nothing, as the field is read too late, and additional
languages have already been considered. As such if the language
requested is closer to C (for example you want C but have a C++ source
with only extern C functions) then link_langauge is ignored.
Fixes #6453
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r-- | mesonbuild/build.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 8cef017..4a8e9cc 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -1219,10 +1219,6 @@ You probably should put it in link_with instead.''') ''' langs = [] # type: T.List[str] - # User specified link_language of target (for multi-language targets) - if self.link_language: - return [self.link_language] - # Check if any of the external libraries were written in this language for dep in self.external_deps: if dep.language is None: @@ -1253,6 +1249,12 @@ You probably should put it in link_with instead.''') # Populate list of all compilers, not just those being used to compile # sources in this target all_compilers = self.environment.coredata.compilers[self.for_machine] + + # If the user set the link_language, just return that. + if self.link_language: + comp = all_compilers[self.link_language] + return comp, comp.language_stdlib_only_link_flags() + # Languages used by dependencies dep_langs = self.get_langs_used_by_deps() # Pick a compiler based on the language priority-order |