When A is a Separate Code Base
What you do is build and install project A. Then create a dependency on project A in project B's definition.
That looks like this:
a_dep = dependency('a', version : '>=1.2.8')
lib_b = shared_library('proj_b', sources: 'prog_b.c', dependencies : a_dep)
The version section in dependency
is optional.
When A is in the Same Meson Project as B
When A and B are in the same meson project, it's a little uglier. You have to declare a dependency anchor in A.
That looks like this:
incdirs = include_directories('include')
lib_a = static_library('a', 'proj_a.c', include_directories : indirs)
liba_dependency = declare_dependency(
include_directories : incdirs,
link_with : lib_a,
sources : ['proj_a.c'])
Then project B becomes:
lib_b = shared_library('proj_b', sources: 'prog_b.c', dependencies : lib_a)