From f489aa77e54bb6ed508e81478cd5c71218a981aa Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 8 Apr 2018 13:58:56 +0300 Subject: Added documentation [skip ci] --- docs/markdown/snippets/find-override.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 docs/markdown/snippets/find-override.md (limited to 'docs/markdown/snippets') diff --git a/docs/markdown/snippets/find-override.md b/docs/markdown/snippets/find-override.md new file mode 100644 index 0000000..dd8fe9b --- /dev/null +++ b/docs/markdown/snippets/find-override.md @@ -0,0 +1,27 @@ +## Can override find_program + +It is now possible to override the result of `find_program` to point +to a custom program you want. The overriding is global and applies to +every subproject from there on. Here is how you would use it. + +In master project + +```meson +subproject('mydep') +``` + +In the called subproject: + +```meson +prog = find_program('my_custom_script') +meson.override_find_program('mycodegen', prog) +``` + +In master project (or, in fact, any subproject): + +```meson +genprog = find_program('mycodegen') +``` + +Now `genprog` points to the custom script. If the dependency had come +from the system, then it would point to the system version. -- cgit v1.1 From 0e6a332d0cf8538c5f62a3def646c477c0d772b5 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Wed, 11 Apr 2018 21:44:20 +0530 Subject: Document that override_find_program works on configure_file [skip ci] Also link to the release notes snippet from the Reference manual --- docs/markdown/snippets/find-override.md | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'docs/markdown/snippets') diff --git a/docs/markdown/snippets/find-override.md b/docs/markdown/snippets/find-override.md index dd8fe9b..ef3a4a2 100644 --- a/docs/markdown/snippets/find-override.md +++ b/docs/markdown/snippets/find-override.md @@ -25,3 +25,13 @@ genprog = find_program('mycodegen') Now `genprog` points to the custom script. If the dependency had come from the system, then it would point to the system version. + +You can also use the return value of `configure_file()` to override +a program in the same way as above: + +```meson +prog_script = configure_file(input : 'script.sh.in', + output : 'script.sh', + configuration : cdata) +meson.override_find_program('mycodegen', prog_script) +``` -- cgit v1.1