diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py index 15aaef898393..6720d0c20450 100644 --- a/mesonbuild/compilers/detect.py +++ b/mesonbuild/compilers/detect.py @@ -1049,7 +1049,10 @@ def detect_cython_compiler(env: 'Environment', for_machine: MachineChoice) -> Co def detect_vala_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler: from .vala import ValaCompiler - exelist = env.lookup_binary_entry(MachineChoice.BUILD, 'vala') + exelist = env.lookup_binary_entry(for_machine, 'vala') + if exelist is None and for_machine != MachineChoice.BUILD: + # This is wrong, but backwards-compatible. + exelist = env.lookup_binary_entry(MachineChoice.BUILD, 'vala') if exelist is None: # TODO support fallback exelist = [defaults['vala'][0]]