diff options
Diffstat (limited to 'docs/markdown/Configuration.md')
-rw-r--r-- | docs/markdown/Configuration.md | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/docs/markdown/Configuration.md b/docs/markdown/Configuration.md index 8b79bc6..cd1af14 100644 --- a/docs/markdown/Configuration.md +++ b/docs/markdown/Configuration.md @@ -121,6 +121,38 @@ you to specify which file encoding to use. It is however strongly advised to convert your non utf-8 file to utf-8 whenever possible. Supported file encodings are those of python3, see [standard-encodings](https://docs.python.org/3/library/codecs.html#standard-encodings). +## Using dictionaries + +Since *0.49.0* `configuration_data()` takes an optional dictionary as first +argument. If provided, each key/value pair is added into the +`configuration_data` as if `set()` method was called for each of them. +`configure_file()`'s `configuration` kwarg also accepts a dictionary instead of +a configuration_data object. + +Example: +```meson +cdata = configuration_data({ + 'STRING' : '"foo"', + 'INT' : 42, + 'DEFINED' : true, + 'UNDEFINED' : false, +}) + +configure_file(output : 'config1.h', + configuration : cdata, +) + +configure_file(output : 'config2.h', + configuration : { + 'STRING' : '"foo"', + 'INT' : 42, + 'DEFINED' : true, + 'UNDEFINED' : false, + } +) + +``` + # A full example Generating and using a configuration file requires the following steps: |