oz10
oz10

Reputation: 158254

With meson build can I define intra-project dependencies?

Say I'm building targets A, B, and C in one project. In meson, is it possible to define dependency relationships between them?

For example, if the dependency graph looks like this:

A -> C
B -> C 

How could I express this with meson?

Upvotes: 1

Views: 1192

Answers (1)

oz10
oz10

Reputation: 158254

Yes, it is possible to define intra-project dependencies. I found this test case on github.com to demonstrate how to do it. You can also refer to the section on dependencies in the manual.

Say I have a meson.build file defining two targets:

project('Demonstrate Dependencies', 'cpp')

subdir('src')
subdir('proj')

proj builds a library that src will depend on. Then proj/meson.build will look something like this:

incdirs = include_directories('include')
proj_lib = static_library('proj', 'proj.c', include_directories : incdirs)

proj_dep = declare_dependency(
      include_directories : incdirs
    , link_with : proj)

And src/meson.build would look something like:

exe = executable('proj_exe', 'main.c', dependencies : proj_dep)

Upvotes: 3

Related Questions