From 6e59a7902dec337d0861962309ade9fde33197a7 Mon Sep 17 00:00:00 2001 From: Chris Collins Date: Fri, 5 Jan 2024 15:21:14 +1100 Subject: [PATCH] MesonToolchain: respect can_run when deciding to cross compile * #15392: MesonToolchain was only using the internal cross_building test and not using can_run (which respects the conf value). Fix this so we can force cross-compilation where the host cannot run the binary despite it seeming like it should be able to. --- conan/tools/meson/toolchain.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conan/tools/meson/toolchain.py b/conan/tools/meson/toolchain.py index 394612f4b78..eb9cdba8b36 100644 --- a/conan/tools/meson/toolchain.py +++ b/conan/tools/meson/toolchain.py @@ -7,7 +7,7 @@ from conan.internal import check_duplicated_generator from conan.tools.apple.apple import to_apple_arch, is_apple_os, apple_min_version_flag, \ apple_sdk_path -from conan.tools.build.cross_building import cross_building +from conan.tools.build.cross_building import can_run from conan.tools.build.flags import libcxx_flags from conan.tools.env import VirtualBuildEnv from conan.tools.meson.helpers import * @@ -152,7 +152,7 @@ def __init__(self, conanfile, backend=None): self.cross_build = {} default_comp = "" default_comp_cpp = "" - if cross_building(conanfile, skip_x64_x86=True): + if not can_run(conanfile): os_host = conanfile.settings.get_safe("os") arch_host = conanfile.settings.get_safe("arch") os_build = conanfile.settings_build.get_safe('os')