meson icon indicating copy to clipboard operation
meson copied to clipboard

Cannot run_target() from a subproject: unknown target type

Open lorcap opened this issue 5 months ago • 0 comments

Describe the bug A run_target() in a subproject is not accessible.

To Reproduce

  1. Create the following two meson.build scripts:
cat > meson.build <<END
project('main')
A_prj = subproject('A')
run_target('hello_main', command: ['/usr/bin/echo', 'hello_main'])
END

mkdir -p subprojects/A
cat > subprojects/A/meson.build <<END
project('A')
run_target('hello_A', command: ['/usr/bin/echo', 'hello_A'])
END
  1. Run meson setup build.
  2. The command meson compile -C build hello_main prints hello_main as expected.
  3. Command meson compile -C build A:hello_A fails with:
ERROR: Can't invoke target `A:hello_A`: unknown target type: `hello_A`
  1. Command meson compile -C build hello_A fails with:
INFO: calculating backend command to run: /usr/bin/ninja -C /home/lorcap/meson-test/build hello_A
ninja: Entering directory `/home/lorcap/meson-test/build'
ninja: error: unknown target 'hello_A', did you mean 'A@@hello_A'?
  1. Command meson compile -C build A@@hello_A fails with:
ERROR: Can't invoke target `A@@hello_A`: target not found

Expected behavior Command meson compile -C build A:hello_A should run successfully and print hello_A.

System parameters

  • plain native build
  • Linux 6.10.6-arch1-1
  • Python 3.12.4
  • meson 1.5.1
  • ninja 1.12.1

lorcap avatar Aug 28 '24 14:08 lorcap