I'm trying to create a list of unit test targets in Meson, with each test case built from a single source file. The source files are defined with a files() command in a subdirectory:
my_test_files = files(['test_foo.c','test_bar.c','test_baz.c'])
What I'd like to do is something like this in the top-level build:
foreach t_file : my_test_files
t_name = t.split('.')[0]
test(t_name, executable(t_name, t_file, ...))
endforeach
I know it's possible to do this if the file names are plain strings, but the above approach fails with a 'File object is not callable' error.
Is there a more 'Mesonic' way to derive the executable / test name from the source file name?