Improve documentation about using shell in custom_target() [skip ci]

Add a note about the portability of using shell constructs in the
custom_target() command.
pull/7806/head
Jon Turney 5 years ago committed by Jussi Pakkanen
parent be2598a4e2
commit ff186b0526
  1. 9
      docs/markdown/Custom-build-targets.md
  2. 4
      docs/markdown/Reference-manual.md

@ -29,14 +29,15 @@ it does for source generation.
See [Generating Sources](Generating-sources.md) for more information on this topic. See [Generating Sources](Generating-sources.md) for more information on this topic.
## Details on compiler invocations ## Details on command invocation
Meson only permits you to specify one command to run. This is by Meson only permits you to specify one command to run. This is by
design as writing shell pipelines into build definition files leads to design as writing shell pipelines into build definition files leads to
code that is very hard to maintain. If your compilation requires code that is very hard to maintain. If your command requires
multiple steps you need to write a wrapper script that does all the multiple steps you need to write a wrapper script that does all the
necessary work. When doing this you need to be mindful of the necessary work.
following issues:
When doing this you need to be mindful of the following issues:
* do not assume that the command is invoked in any specific directory * do not assume that the command is invoked in any specific directory
* a target called `target` file `outfile` defined in subdir `subdir` * a target called `target` file `outfile` defined in subdir `subdir`

@ -397,6 +397,10 @@ the following special string substitutions:
The returned object also has methods that are documented in the The returned object also has methods that are documented in the
[object methods section](#custom-target-object) below. [object methods section](#custom-target-object) below.
**Note:** Assuming that `command:` is executed by a POSIX `sh` shell is not
portable, notably to Windows. Instead, consider using a `native: true`
[executable()](#executable), or a python script.
### declare_dependency() ### declare_dependency()
``` meson ``` meson

Loading…
Cancel
Save