aboutsummaryrefslogtreecommitdiff
path: root/docs/yaml/functions/include_directories.yaml
blob: 77faeb4f3caf60e8a4223b490a9cf61b3ae6610a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: include_directories
returns: inc
description: |
  Returns an opaque object which contains the directories (relative to
  the current directory) given in the positional arguments. The result
  can then be passed to the `include_directories:` keyword argument when
  building executables or libraries. You can use the returned object in
  any subdirectory you want, Meson will make the paths work
  automatically.

  Note that this function call itself does not add the directories into
  the search path, since there is no global search path. For something
  like that, see [`add_project_arguments()`](#add_project_arguments).

  See also `implicit_include_directories` parameter of
  [[executable]], which adds current source and build
  directories to include path.

  Each directory given is converted to two include paths: one that is
  relative to the source root and one relative to the build root.

example: |
  For example, with the following source tree layout in
  `/home/user/project.git`:

  `meson.build`:
  ```meson
  project(...)

  subdir('include')
  subdir('src')

  ...
  ```

  `include/meson.build`:
  ```meson
  inc = include_directories('.')

  ...
  ```

  `src/meson.build`:
  ```meson
  sources = [...]

  executable('some-tool', sources,
    include_directories : inc,
    ...)

  ...
  ```

  If the build tree is `/tmp/build-tree`, the following include paths
  will be added to the `executable()` call: `-I/tmp/build-tree/include
  -I/home/user/project.git/include`.

varargs:
  name: includes
  type: str
  description: Include paths to add.

kwargs:
  is_system:
    type: bool
    default: false
    description: |
      If set to `true`, flags the specified directories as system directories.
      This means that
      they will be used with the `-isystem` compiler argument rather than
      `-I` on compilers that support this flag (in practice everything
      except Visual Studio).