meson
                                
                                 meson copied to clipboard
                                
                                    meson copied to clipboard
                            
                            
                            
                        Cannot run_target() from a subproject: unknown target type
Describe the bug
A run_target() in a subproject is not accessible.
To Reproduce
- Create the following two meson.buildscripts:
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
- Run meson setup build.
- The command meson compile -C build hello_mainprintshello_mainas expected.
- Command meson compile -C build A:hello_Afails with:
ERROR: Can't invoke target `A:hello_A`: unknown target type: `hello_A`
- Command meson compile -C build hello_Afails 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'?
- Command meson compile -C build A@@hello_Afails 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