diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2018-12-18 13:42:44 -0800 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-12-19 01:25:17 +0200 |
commit | 05fc81ac3527e66e8460c6a33c84e83c1e84b63c (patch) | |
tree | 884478bff237c85b2a57bee2f6f001ee8f8676e1 /docs/markdown/Syntax.md | |
parent | 4ffd009fe930a4996aff22ce23c0fd5dea11ba8b (diff) | |
download | meson-05fc81ac3527e66e8460c6a33c84e83c1e84b63c.zip meson-05fc81ac3527e66e8460c6a33c84e83c1e84b63c.tar.gz meson-05fc81ac3527e66e8460c6a33c84e83c1e84b63c.tar.bz2 |
docs: Add warning about not using join_paths() with build targets [skip ci]
This comes up now and again when people try do do something like:
meson.build:
```meson
my_sources = ['foo.c']
subdir('subdir')
executable('foo', my_sources)
```
subdir/meson.build:
```meson
my_sources += ['bar.c']
```
Diffstat (limited to 'docs/markdown/Syntax.md')
-rw-r--r-- | docs/markdown/Syntax.md | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/docs/markdown/Syntax.md b/docs/markdown/Syntax.md index 9ea96c1..cf56dd3 100644 --- a/docs/markdown/Syntax.md +++ b/docs/markdown/Syntax.md @@ -216,6 +216,14 @@ path = pathsep.join(['/usr/bin', '/bin', '/usr/local/bin']) path = join_paths(['/usr', 'local', 'bin']) # path now has the value '/usr/local/bin' +# Don't use join_paths for sources files, use files for that: +my_sources = files('foo.c') +... +my_sources += files('bar.c') +# This has the advantage of always calculating the correct relative path, even +# if you add files in another directory or use them in a different directory +# than they're defined in + # Example to set an API version for use in library(), install_header(), etc project('project', 'c', version: '0.2.3') version_array = meson.project_version().split('.') |