kumquat-buildroot/support/misc/cross-compilation.conf.in
Andreas Ziegler 6ab8b1e263 meson-package: prevent cmake find_package() picking up host libraries
The meson build system uses (1) pkg-config and (2) cmake find_package to locate
dependencies and stops only if a package is found. Cmake uses a toolchain file
that is generated by meson from the existing configuration [1].

The cmake toolchain file misses CMAKE_FIND_ROOT_PATH and CMAKE_FIND_ROOT_PATH_*
settings, and find_package() falls back to the default behaviour and looks for
dependencies on the build machine (the Buildroot HOST_DIR).

Use a feature introduced in meson 0.56.0 [2] to pass the Buildroot toolchain
file to cmake instead of using a meson-generated one.

Fixes the following build failures:
http://autobuild.buildroot.org/results/056/05673ed04c6f044f1b56b9d5342d61653be43a18/
http://autobuild.buildroot.org/results/f0a/f0a9e719114f19dc9d20622ed85dd4f8e968c20f/
http://autobuild.buildroot.org/results/527/527ee199813abbacd61c3fa32b517ea60af60659/

[1[ see mesonbuild/cmake/toolchain.py
[2] see https://mesonbuild.com/CMake-module.html#cross-compilation

Signed-off-by: Andreas Ziegler <br015@umbiko.net>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2022-04-21 21:42:49 +02:00

38 lines
1.1 KiB
Plaintext

# Note: Buildroot's and Meson's terminologies differ about the meaning
# of 'build', 'host' and 'target':
# - Buildroot's 'host' is Meson's 'build'
# - Buildroot's 'target' is Meson's 'host'
[binaries]
c = '@TARGET_CC@'
cpp = '@TARGET_CXX@'
ar = '@TARGET_AR@'
strip = '@TARGET_STRIP@'
cmake = '@BR2_CMAKE@'
pkgconfig = '@PKGCONF_HOST_BINARY@'
g-ir-compiler = '@STAGING_DIR@/usr/bin/g-ir-compiler'
g-ir-scanner = '@STAGING_DIR@/usr/bin/g-ir-scanner'
[built-in options]
c_args = [@TARGET_CFLAGS@]
c_link_args = [@TARGET_LDFLAGS@]
cpp_args = [@TARGET_CXXFLAGS@]
cpp_link_args = [@TARGET_LDFLAGS@]
wrap_mode = 'nodownload'
cmake_prefix_path = '@STAGING_DIR@/usr/lib/cmake'
[properties]
needs_exe_wrapper = true
sys_root = '@STAGING_DIR@'
pkg_config_libdir = '@STAGING_DIR@/usr/lib/pkgconfig:@STAGING_DIR@/usr/share/pkgconfig'
pkg_config_static = '@STATIC@'
# enable meson build to pass a toolchain file to cmake
cmake_toolchain_file = '@HOST_DIR@/share/buildroot/toolchainfile.cmake'
cmake_defaults = false
[host_machine]
system = 'linux'
cpu_family = '@TARGET_ARCH@'
cpu = '@TARGET_CPU@'
endian = '@TARGET_ENDIAN@'