0

I have a Meson project that includes a test suite to be run on the build machine even during cross compilation. The test executables are tagged native: true, but they pull in catch2 as a dependency through the wrapdb, and that isn't native, leading to errors during cross build.

project('demo', 'cpp', default_options: [ 'cpp_std=c++20' ])

catch2 = dependency('catch2-with-main',
    fallback: [ 'catch2', 'catch2_with_main_dep' ],
    default_options: [ 'tests=false' ],
    native: true)

uut_lib = static_library('uut', 'uut.cpp', native: true)
uut_inc = include_directories('.')
uut = declare_dependency(
    link_with: [ uut_lib ],
    include_directories: [ uut_inc ])

test('test1',
    executable('test1', 'test1.cpp',
        dependencies: [ uut, catch2 ],
        native: true))

Is there a way I can configure a subproject as native=true?

Simon Richter
  • 28,572
  • 1
  • 42
  • 64
  • Did you try to specify `native` for your `dependency` as well? https://github.com/mesonbuild/meson/blob/cf5adf0c646474f0259d123fad60ca5ed38ec891/docs/yaml/functions/dependency.yaml#L144 – Elvis Oric Aug 31 '23 at 20:41
  • @ElvisOric, yes -- added a test project that shows the problem. Configuring this complains twice about mixing libraries for machines 0 and 1. – Simon Richter Sep 01 '23 at 02:04

0 Answers0