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.pull/13075/merge
parent
a111c28ece
commit
9be6e653d4
7 changed files with 42 additions and 5 deletions
@ -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`. |
@ -0,0 +1,8 @@ |
||||
#!/usr/bin/env python3 |
||||
|
||||
import sys |
||||
|
||||
if len(sys.argv) != 2 or sys.argv[1] != '-version': |
||||
exit(1) |
||||
|
||||
print('1.0') |
Loading…
Reference in new issue