aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/Syntax.md
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-12-02 22:40:43 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2018-12-04 23:44:17 +0200
commit58b838a80bfe1d3307e730c293ce91cb93b332c9 (patch)
treed4a385b084b63872a0768a0f439a4ab9bc794932 /docs/markdown/Syntax.md
parentc17a80f47b772d759aeb0878aa767a768a6fdd0c (diff)
downloadmeson-58b838a80bfe1d3307e730c293ce91cb93b332c9.zip
meson-58b838a80bfe1d3307e730c293ce91cb93b332c9.tar.gz
meson-58b838a80bfe1d3307e730c293ce91cb93b332c9.tar.bz2
Can specify keyword arguments with a dict.
Diffstat (limited to 'docs/markdown/Syntax.md')
-rw-r--r--docs/markdown/Syntax.md42
1 files changed, 39 insertions, 3 deletions
diff --git a/docs/markdown/Syntax.md b/docs/markdown/Syntax.md
index 22b8be3..9ea96c1 100644
--- a/docs/markdown/Syntax.md
+++ b/docs/markdown/Syntax.md
@@ -138,9 +138,9 @@ int main (int argc, char ** argv) {
}'''
```
-These are raw strings that do not support the escape sequences listed above.
-These strings can also be combined with the string formatting functionality
-described below.
+These are raw strings that do not support the escape sequences listed
+above. These strings can also be combined with the string formatting
+functionality described below.
#### String formatting
@@ -351,6 +351,42 @@ creating build objects.
executable('progname', 'prog.c')
```
+Most functions take only few positional arguments but several keyword
+arguments, which are specified like this:
+
+```meson
+executable('progname',
+ sources: 'prog.c',
+ c_args: '-DFOO=1')
+```
+
+Starting with version 0.49.0 keyword arguments can be specified
+dynamically. This is done by passing dictionary representing the
+keywords to set in the `kwargs` keyword. The previous example would be
+specified like this:
+
+```meson
+d = {'sources': 'prog.c',
+ 'c_args': '-DFOO=1'}
+
+executable('progname',
+ kwargs: d)
+```
+
+A single function can take keyword argumets both directly in the
+function call and indirectly via the `kwargs` keyword argument. The
+only limitation is that it is a hard error to pass any particular key
+both as a direct and indirect argument.
+
+```meson
+d = {'c_args': '-DFOO'}
+executable('progname', 'prog.c',
+ c_args: '-DBAZ=1',
+ kwargs: d) # This is an error!
+```
+
+Attempting to do this causes Meson to immediately exit with an error.
+
Method calls
--