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 = find_program('python3') 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, )