Skip to content

Commit

Permalink
MesonToolchain: respect can_run when deciding to cross compile
Browse files Browse the repository at this point in the history
* conan-io#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.
  • Loading branch information
kuroneko committed Jan 5, 2024
1 parent 35a9d7d commit 6e59a79
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions conan/tools/meson/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 6e59a79

Please sign in to comment.