| 1 |
name: include_directories |
| 2 |
returns: inc |
| 3 |
description: | |
| 4 |
Returns an opaque object which contains the directories (relative to |
| 5 |
the current directory) given in the positional arguments. The result |
| 6 |
can then be passed to the `include_directories:` keyword argument when |
| 7 |
building executables or libraries. You can use the returned object in |
| 8 |
any subdirectory you want, Meson will make the paths work |
| 9 |
automatically. |
| 10 |
|
| 11 |
Note that this function call itself does not add the directories into |
| 12 |
the search path, since there is no global search path. For something |
| 13 |
like that, see [`add_project_arguments()`](#add_project_arguments). |
| 14 |
|
| 15 |
See also `implicit_include_directories` parameter of |
| 16 |
[[executable]], which adds current source and build |
| 17 |
directories to include path. |
| 18 |
|
| 19 |
Each directory given is converted to two include paths: one that is |
| 20 |
relative to the source root and one relative to the build root. |
| 21 |
|
| 22 |
example: | |
| 23 |
For example, with the following source tree layout in |
| 24 |
`/home/user/project.git`: |
| 25 |
|
| 26 |
`meson.build`: |
| 27 |
```meson |
| 28 |
project(...) |
| 29 |
|
| 30 |
subdir('include') |
| 31 |
subdir('src') |
| 32 |
|
| 33 |
... |
| 34 |
``` |
| 35 |
|
| 36 |
`include/meson.build`: |
| 37 |
```meson |
| 38 |
inc = include_directories('.') |
| 39 |
|
| 40 |
... |
| 41 |
``` |
| 42 |
|
| 43 |
`src/meson.build`: |
| 44 |
```meson |
| 45 |
sources = [...] |
| 46 |
|
| 47 |
executable('some-tool', sources, |
| 48 |
include_directories : inc, |
| 49 |
...) |
| 50 |
|
| 51 |
... |
| 52 |
``` |
| 53 |
|
| 54 |
If the build tree is `/tmp/build-tree`, the following include paths |
| 55 |
will be added to the `executable()` call: `-I/tmp/build-tree/include |
| 56 |
-I/home/user/project.git/include`. |
| 57 |
|
| 58 |
varargs: |
| 59 |
name: includes |
| 60 |
type: str |
| 61 |
description: Include paths to add. |
| 62 |
|
| 63 |
kwargs: |
| 64 |
is_system: |
| 65 |
type: bool |
| 66 |
default: false |
| 67 |
description: | |
| 68 |
If set to `true`, flags the specified directories as system directories. |
| 69 |
This means that |
| 70 |
they will be used with the `-isystem` compiler argument rather than |
| 71 |
`-I` on compilers that support this flag (in practice everything |
| 72 |
except Visual Studio). |