aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/snippets
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2017-09-25 13:46:07 -0700
committerJussi Pakkanen <jpakkane@gmail.com>2017-09-27 22:01:24 +0300
commitdda5e8cadbfdeee3267b1a0943c014e06bcd0100 (patch)
tree049a70c550729d722e23c67d8312c2eaa820da6f /docs/markdown/snippets
parentdfc2b75ee2dba3245ac23bb3d7f0156e47773ed5 (diff)
downloadmeson-dda5e8cadbfdeee3267b1a0943c014e06bcd0100.zip
meson-dda5e8cadbfdeee3267b1a0943c014e06bcd0100.tar.gz
meson-dda5e8cadbfdeee3267b1a0943c014e06bcd0100.tar.bz2
Allow CustomTarget's to be indexed
This allows a CustomTarget to be indexed, and the resulting indexed value (a CustomTargetIndex type), to be used as a source in other targets. This will confer a dependency on the original target, but only inserts the source file returning by index the original target's outputs. This can allow a CustomTarget that creates both a header and a code file to have it's outputs split, for example. Fixes #1470
Diffstat (limited to 'docs/markdown/snippets')
-rw-r--r--docs/markdown/snippets/custom-target-index.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/docs/markdown/snippets/custom-target-index.md b/docs/markdown/snippets/custom-target-index.md
new file mode 100644
index 0000000..10d7cf1
--- /dev/null
+++ b/docs/markdown/snippets/custom-target-index.md
@@ -0,0 +1,21 @@
+# Can index CustomTaget objects
+
+The `CustomTarget` object can now be indexed like an array. The resulting
+object can be used as a source file for other Targets, this will create a
+dependency on the original `CustomTarget`, but will only insert the generated
+file corresponding to the index value of the `CustomTarget`'s `output` keyword.
+
+ c = CustomTarget(
+ ...
+ output : ['out.h', 'out.c'],
+ )
+ lib1 = static_library(
+ 'lib1',
+ [lib1_sources, c[0]],
+ ...
+ )
+ exec = executable(
+ 'executable',
+ c[1],
+ link_with : lib1,
+ )