diff options
author | Andrea G <muffo87@gmail.com> | 2018-02-11 19:05:05 -0800 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2018-02-12 19:48:57 +0530 |
commit | 030c39f33e8d64cef356258c0f865f0c0880ae7b (patch) | |
tree | 2c958735d1dc6e391e46331eae4912d53326ba03 /docs | |
parent | d589cc26c7907e89fc169d90f1b8482779a5c548 (diff) | |
download | meson-030c39f33e8d64cef356258c0f865f0c0880ae7b.zip meson-030c39f33e8d64cef356258c0f865f0c0880ae7b.tar.gz meson-030c39f33e8d64cef356258c0f865f0c0880ae7b.tar.bz2 |
Use the same name for the conf_data variable
Before, each example used a different variable name making them more difficult to understand for a novice.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/markdown/Configuration.md | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/docs/markdown/Configuration.md b/docs/markdown/Configuration.md index 9db6370..d8fa54e 100644 --- a/docs/markdown/Configuration.md +++ b/docs/markdown/Configuration.md @@ -58,7 +58,7 @@ Note that if you want to define a C string, you need to do the quoting yourself like this: ```meson -conf.set('TOKEN', '"value"') +conf_data.set('TOKEN', '"value"') ``` Since this is such a common operation, Meson provides a convenience @@ -66,7 +66,7 @@ method: ```meson plain_var = 'value' -conf.set_quoted('TOKEN', plain_var) # becomes #define TOKEN "value" +conf_data.set_quoted('TOKEN', plain_var) # becomes #define TOKEN "value" ``` Often you have a boolean value in Meson but need to define the C/C++ @@ -74,12 +74,12 @@ token as 0 or 1. Meson provides a convenience function for this use case. ```meson -conf.set10(token, boolean_value) +conf_data.set10(token, boolean_value) # The line above is equivalent to this: if boolean_value - conf.set(token, 1) + conf_data.set(token, 1) else - conf.set(token, 0) + conf_data.set(token, 0) endif ``` @@ -90,19 +90,19 @@ file all the entries in the configuration data object. The replacements are the same as when generating `#mesondefine` entries: ```meson -cdata.set('FOO', '"string"') => #define FOO "string" -cdata.set('FOO', 'a_token') => #define FOO a_token -cdata.set('FOO', true) => #define FOO -cdata.set('FOO', false) => #undef FOO -cdata.set('FOO', 1) => #define FOO 1 -cdata.set('FOO', 0) => #define FOO 0 +conf_data.set('FOO', '"string"') => #define FOO "string" +conf_data.set('FOO', 'a_token') => #define FOO a_token +conf_data.set('FOO', true) => #define FOO +conf_data.set('FOO', false) => #undef FOO +conf_data.set('FOO', 1) => #define FOO 1 +conf_data.set('FOO', 0) => #define FOO 0 ``` In this mode, you can also specify a comment which will be placed before the value so that your generated files are self-documenting. ```meson -cdata.set('BAR', true, description : 'Set BAR if it is available') +conf_data.set('BAR', true, description : 'Set BAR if it is available') ``` Will produce: @@ -129,9 +129,11 @@ subprojects. At the top level we generate the file: ```meson +conf_data = configuration_data() +# Set data configure_file(input : 'projconfig.h.in', output : 'projconfig.h', - configuration : cdata_object) + configuration : conf_data) ``` Immediately afterwards we generate the include object. |