summaryrefslogtreecommitdiff
path: root/docs/markdown/snippets/build_subdir.md
blob: 0c115d05de1465a947fe6c28b219706f1c1d02e2 (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
## Added `build_subdir` arg to various targets

`custom_target()`, `build_target()` and `configure_file()` now support
the `build_subdir` argument. This directs meson to place the build
result within the specified sub-directory path of the build directory.

```meson
configure_file(input : files('config.h.in'),
               output : 'config.h',
               build_subdir : 'config-subdir',
               install_dir : 'share/appdir',
               configuration : conf)
```

This places the build result, `config.h`, in a sub-directory named
`config-subdir`, creating it if necessary. To prevent collisions
within the build directory, `build_subdir` is not allowed to match a
file or directory in the source directory nor contain '..' to refer to
the parent of the build directory. `build_subdir` does not affect the
install directory path at all; `config.h` will be installed as
`share/appdir/config.h`. `build_subdir` may contain multiple levels of
directory names.

This allows construction of files within the build system that have
any required trailing path name components as well as building
multiple files with the same basename from the same source directory.