summaryrefslogtreecommitdiffstats
path: root/test cases/common/257 generated header dep/meson.build
blob: 195d082ac18a3c8a76e661b20b29c8befcbde3cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
project('generated header dep', 'c')

# Regression test case for a very specific case:
# - Uses both_libraries(), or library() with default_library=both.
# - A header file is generated by a custom_target() and passed as source.
# - A C file that uses that header is passed as a declare_dependency() source.
# Under those specific conditions, the static library used to miss an order
# dependency on the header file. This happened in GLib:
# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2917.

python = import('python').find_installation()
header = custom_target(
  output: 'foo.h',
  capture: true,
  command: [python, '-c', 'print("#define FOO")'],
)

sources_dep = declare_dependency(sources: files('foo.c'))

both_libraries('foo', header,
  dependencies: sources_dep,
)