diff options
| author | Dudemanguy <random342@airmail.cc> | 2024-06-22 10:59:05 -0500 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2024-06-23 15:10:42 +0300 |
| commit | 9be6e653d49957c974af2c171257cbaf942abbb9 (patch) | |
| tree | 788b00fc4997ec587ccc64e21cba1b7d7f030dc1 /docs | |
| parent | a111c28ecef721af960721c26b40f4e5108760c7 (diff) | |
| download | meson-9be6e653d49957c974af2c171257cbaf942abbb9.tar.gz | |
find_program: add a kwarg to specify custom version argument
When trying to get the version of a program, meson was previously
hardcoded to run the binary with `--version`. This does work with the
vast majority of programs, but there are a few outliers (e.g. ffmpeg)
which have an unusual argument for printing out the version. Support
these programs by introducing a version_argument kwarg in find_program
which allows users to override `--version` with whatever the custom
argument for printing the version may be for the program.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/markdown/snippets/find_program_version_argument.md | 12 | ||||
| -rw-r--r-- | docs/yaml/functions/find_program.yaml | 9 |
2 files changed, 20 insertions, 1 deletions
diff --git a/docs/markdown/snippets/find_program_version_argument.md b/docs/markdown/snippets/find_program_version_argument.md new file mode 100644 index 000000000..99fe62109 --- /dev/null +++ b/docs/markdown/snippets/find_program_version_argument.md @@ -0,0 +1,12 @@ +## New version_argument kwarg for find_program + +When finding an external program with `find_program`, the `version_argument` +can be used to override the default `--version` argument when trying to parse +the version of the program. + +For example, if the following is used: +```meson +foo = find_program('foo', version_argument: '-version') +``` + +meson will internally run `foo -version` when trying to find the version of `foo`. diff --git a/docs/yaml/functions/find_program.yaml b/docs/yaml/functions/find_program.yaml index 4a17e8637..1899941ab 100644 --- a/docs/yaml/functions/find_program.yaml +++ b/docs/yaml/functions/find_program.yaml @@ -102,13 +102,20 @@ kwargs: since: 0.52.0 description: | Specifies the required version, see - [[dependency]] for argument format. The version of the program + [[dependency]] for argument format. By default, the version of the program is determined by running `program_name --version` command. If stdout is empty it fallbacks to stderr. If the output contains more text than simply a version number, only the first occurrence of numbers separated by dots is kept. If the output is more complicated than that, the version checking will have to be done manually using [[run_command]]. + version_argument: + type: str + since: 1.5.0 + description: | + Specifies the argument to pass when trying to find the version of the program. + If this is unspecified, `program_name --version` will be used. + dirs: type: list[str] since: 0.53.0 |
