How to meson.override_find_program() with find_program()

101 views
Skip to first unread message

vl...@jens-carl.de

unread,
May 2, 2023, 2:54:29 PM5/2/23
to meson...@googlegroups.com
Hello,

I'm trying to write a wrap for a subproject and the project has a script
that needs to be run to generate some data.

I created the project.wrap file

[wrap-git]
...

[provides]
project = project_dep
program_names = project_generator

and in the meson.build file if have a section to find the script and
trying use meson.override_find_program() as

project_script_path = join_paths(meson.current_source_dir(), 'scripts')
project_generator_script = find_program('project_generator',
dirs: [project_script_path])
meson.override_find_program('project_generator',
project_generator_script)

But I'm getting an error:

ERROR: Tried to override finding of executable "project_generator" which
has already been found.

I'm using meson 1.1.0

How do I use find_program() result with meson.override_find_program()?
If my approach is wrong how should I do it?

Or should I expose the script as a generator()?

Cheers,
Jens

Eli Schwartz

unread,
May 2, 2023, 11:29:53 PM5/2/23
to vl...@jens-carl.de, meson...@googlegroups.com
Since the purpose of override_find_program is to change what
find_program would find, if you have previously attempted to find that
program it is too late to then override it retroactively. If it did
work, then you'd end up in a loop. :D

For this case, you should actually be able to just use
files('scripts/project_generator') since override_find_program accepts
"files" objects.


--
Eli Schwartz

Jens Carl

unread,
May 5, 2023, 2:12:21 AM5/5/23
to meson...@googlegroups.com
On 5/2/23 20:29, Eli Schwartz wrote:
> Since the purpose of override_find_program is to change what
> find_program would find, if you have previously attempted to find that
> program it is too late to then override it retroactively. If it did
> work, then you'd end up in a loop. :D
>
> For this case, you should actually be able to just use
> files('scripts/project_generator') since override_find_program accepts
> "files" objects.
>
>
Thanks for the great help.


Reply all
Reply to author
Forward
0 new messages