Skip to content

Commit e6384b0

Browse files
sp1ritCSjpakkane
authored andcommitted
build: Ensure that linker requested in link_language is available
Meson was running into an key lookup failure when evaluating the following: project('proj', 'c') executable('bin', link_language: 'cpp') and since 41eb18d also if the executable contained exclusively header sources.
1 parent 50c617b commit e6384b0

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

mesonbuild/build.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,11 @@ def process_compilers_late(self) -> None:
882882
# did user override clink_langs for this target?
883883
link_langs = [self.link_language] if self.link_language else clink_langs
884884

885+
if self.link_language:
886+
if self.link_language not in self.all_compilers:
887+
m = f'Target {self.name} requires {self.link_language} compiler not part of the project'
888+
raise MesonException(m)
889+
885890
# If this library is linked against another library we need to consider
886891
# the languages of those libraries as well.
887892
if self.link_targets or self.link_whole_targets:

test cases/failing/135 rust link_language/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-license-identifer: Apache-2.0
22
# Copyright © 2021 Intel Corporation
33

4-
project('rust wrong link language')
4+
project('rust wrong link language', 'c')
55

66
if not add_languages('rust', required: false)
77
error('MESON_SKIP_TEST test requires rust compiler')

0 commit comments

Comments
 (0)