aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/snippets
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2020-06-11 16:04:50 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2020-06-29 20:16:21 +0300
commit1c8731a10018e8ba1e6b30411a290ca50fa45d81 (patch)
tree9c5332199c2acd2f26bb131429e1251b76cd7dfa /docs/markdown/snippets
parent5696a5abbaaff75279d9c50d431de47f35dc6228 (diff)
downloadmeson-1c8731a10018e8ba1e6b30411a290ca50fa45d81.zip
meson-1c8731a10018e8ba1e6b30411a290ca50fa45d81.tar.gz
meson-1c8731a10018e8ba1e6b30411a290ca50fa45d81.tar.bz2
envconfig: Add [constants] section in machine files
Machine files already supports `+` operator as an implementation detail, since it's using eval(). Now make it an officially supported feature and add a way to define constants that are used while evaluating an entry value.
Diffstat (limited to 'docs/markdown/snippets')
-rw-r--r--docs/markdown/snippets/machine_file_constants.md20
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/markdown/snippets/machine_file_constants.md b/docs/markdown/snippets/machine_file_constants.md
new file mode 100644
index 0000000..84b0848
--- /dev/null
+++ b/docs/markdown/snippets/machine_file_constants.md
@@ -0,0 +1,20 @@
+## Machine file constants
+
+Native and cross files now support string and list concatenation using the `+`
+operator, and joining paths using the `/` operator.
+Entries defined in the `[constants]` section can be used in any other section.
+An entry defined in any other section can be used only within that same section and only
+after it has been defined.
+
+```ini
+[constants]
+toolchain = '/toolchain'
+common_flags = ['--sysroot=' + toolchain + '/sysroot']
+
+[properties]
+c_args = common_flags + ['-DSOMETHING']
+cpp_args = c_args + ['-DSOMETHING_ELSE']
+
+[binaries]
+c = toolchain + '/gcc'
+```