Debian Codegraph @

subprojects/meson-docs/docs/yaml/functions/files.yaml

raw
1 name: files
2 returns: list[file]
3 description: |
4 This command takes the strings given to it in arguments and returns
5 corresponding File objects that you can use as sources for build
6 targets. The difference is that file objects remember the subdirectory
7 they were defined in and can be used anywhere in the source tree.
8
9 example: |
10 As an example suppose you have source file `foo.cpp` in subdirectory
11 `bar1` and you would like to use it in a build target that is defined
12 in `bar2`. To make this happen you first create the object in `bar1`
13 like this:
14
15 ```meson
16 foofile = files('foo.cpp')
17 ```
18
19 Then you can use it in `bar2` like this:
20
21 ```meson
22 executable('myprog', 'myprog.cpp', foofile, ...)
23 ```
24
25 Meson will then do the right thing.
26
27 varargs:
28 name: file
29 type: str
30 description: Path to the file.