From 19718a8d9c5cb6d9ac2c2cbb5459178906a3a007 Mon Sep 17 00:00:00 2001 From: Evgenii Shatokhin Date: Sun, 25 Feb 2018 16:02:10 +0300 Subject: Allow passing a compiler object to run_command() Sometimes it is needed to run the current compiler with specific options not to compile a file but rather to obtain additional info. For example, GCC has several -print-* options to query it about the paths to different libraries and development files. One use case is to get the location of development files for GCC plugins, which is not easily obtainable by other means: gcc -print-file-name=plugin For this purpose, it would be convenient if the compiler object returned by meson.get_compiler(lang) could be used in run_command() directly. This commit implements it. Signed-off-by: Evgenii Shatokhin --- docs/markdown/snippets/compiler-object-run_command.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 docs/markdown/snippets/compiler-object-run_command.md (limited to 'docs/markdown/snippets') diff --git a/docs/markdown/snippets/compiler-object-run_command.md b/docs/markdown/snippets/compiler-object-run_command.md new file mode 100644 index 0000000..0308416 --- /dev/null +++ b/docs/markdown/snippets/compiler-object-run_command.md @@ -0,0 +1,10 @@ +## Compiler object can now be passed to run_command() + +This can be used to run the current compiler with the specified arguments +to obtain additional information from it. +One of the use cases is to get the location of development files for the +GCC plugins: + + cc = meson.get_compiler('c') + result = run_command(cc, '-print-file-name=plugin') + plugin_dev_path = result.stdout().strip() -- cgit v1.1