Debian Codegraph @

test cases/common/257 generated header dep/meson.build

raw
1 project('generated header dep', 'c')
2
3 # Regression test case for a very specific case:
4 # - Uses both_libraries(), or library() with default_library=both.
5 # - A header file is generated by a custom_target() and passed as source.
6 # - A C file that uses that header is passed as a declare_dependency() source.
7 # Under those specific conditions, the static library used to miss an order
8 # dependency on the header file. This happened in GLib:
9 # https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2917.
10
11 python = find_program('python3')
12 header = custom_target(
13 output: 'foo.h',
14 capture: true,
15 command: [python, '-c', 'print("#define FOO")'],
16 )
17
18 sources_dep = declare_dependency(sources: files('foo.c'))
19
20 both_libraries('foo', header,
21 dependencies: sources_dep,
22 )