diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2020-04-20 16:23:33 -0400 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2020-04-28 01:39:56 +0300 |
commit | 39a69d1fb0e130fae9f64b81e0a992503869a97a (patch) | |
tree | 2f9cbed234a6d55ba033acda49ec438e7c34fa3a /docs | |
parent | 34e7e8780c0196313be8700f504ec84fd6cba3d1 (diff) | |
download | meson-39a69d1fb0e130fae9f64b81e0a992503869a97a.zip meson-39a69d1fb0e130fae9f64b81e0a992503869a97a.tar.gz meson-39a69d1fb0e130fae9f64b81e0a992503869a97a.tar.bz2 |
find_program: Fixes when the program has been overridden by executable
- ExternalProgramHolder has path() method while CustomTargetHolder and
BuildTargetHolder have full_path().
- The returned ExternalProgramHolder's path() method was broken, because
build.Executable object has no get_path() method, it needs the
backend.
- find_program('overridden_prog', version : '>=1.0') was broken because
it needs to execute the exe that is not yet built. Now assume the
program has the (sub)project version.
- If the version check fails, interpreter uses
ExternalProgramHolder.get_name() for the error message but
build.Executable does not implement get_name() method.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/markdown/Reference-manual.md | 10 | ||||
-rw-r--r-- | docs/markdown/snippets/find_program.md | 20 |
2 files changed, 29 insertions, 1 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index 5156b5b..963af9d 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -1846,7 +1846,9 @@ the following methods. specifies that whenever `find_program` is used to find a program named `progname`, Meson should not look it up on the system but instead return `program`, which may either be the result of - `find_program`, `configure_file` or `executable`. + `find_program`, `configure_file` or `executable`. *Since 0.55.0* if a version + check is passed to `find_program` for a program that has been overridden with + an executable, the current project version is used. If `program` is an `executable`, it cannot be used during configure. @@ -2460,6 +2462,12 @@ and has the following methods: - `path()` which returns a string pointing to the script or executable **NOTE:** You should not need to use this method. Passing the object itself should work in all cases. For example: `run_command(obj, arg1, arg2)` + *Since 0.55.0* this method has been deprecated in favor of `full_path()` for + consistency with other returned objects. + +- `full_path()` *Since 0.55.0* which returns a string pointing to the script or + executable **NOTE:** You should not need to use this method. Passing the object + itself should work in all cases. For example: `run_command(obj, arg1, arg2)`. ### `environment` object diff --git a/docs/markdown/snippets/find_program.md b/docs/markdown/snippets/find_program.md new file mode 100644 index 0000000..d0bb64d --- /dev/null +++ b/docs/markdown/snippets/find_program.md @@ -0,0 +1,20 @@ +## find_program: Fixes when the program has been overridden by executable + +When a program has been overridden by an executable, the returned object of +find_program() had some issues: + +```meson +# In a subproject: +exe = executable('foo', ...) +meson.override_find_program('foo', exe) + +# In main project: +# The version check was crashing meson. +prog = find_program('foo', version : '>=1.0') + +# This was crashing meson. +message(prog.path()) + +# New method to be consistent with built objects. +message(prog.full_path()) +``` |