1 | <html> |
---|
2 | <head> |
---|
3 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
---|
4 | <title>Can I get output of external program as a variable in a Jamfile? |
---|
5 | </title> |
---|
6 | <link rel="stylesheet" href="../../boostbook.css" type="text/css"> |
---|
7 | <meta name="generator" content="DocBook XSL Stylesheets V1.69.1"> |
---|
8 | <style type="text/css"> |
---|
9 | body { background-image: url('http://docbook.sourceforge.net/release/images/draft.png'); |
---|
10 | background-repeat: no-repeat; |
---|
11 | background-position: top left; |
---|
12 | /* The following properties make the watermark "fixed" on the page. */ |
---|
13 | /* I think that's just a bit too distracting for the reader... */ |
---|
14 | /* background-attachment: fixed; */ |
---|
15 | /* background-position: center center; */ |
---|
16 | }</style> |
---|
17 | <link rel="start" href="../../index.html" title="The Boost C++ Libraries"> |
---|
18 | <link rel="up" href="../faq.html" title="Chapter 27. Frequently Asked Questions"> |
---|
19 | <link rel="prev" href="s04.html" title=" |
---|
20 | How to control the library order on Unix? |
---|
21 | "> |
---|
22 | <link rel="next" href="s06.html" title="How to get the project-root location? |
---|
23 | "> |
---|
24 | </head> |
---|
25 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
---|
26 | <table cellpadding="2" width="100%"> |
---|
27 | <td valign="top"><img alt="boost.png (6897 bytes)" width="277" height="86" src="../../../../boost.png"></td> |
---|
28 | <td align="center"><a href="../../../../index.htm">Home</a></td> |
---|
29 | <td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td> |
---|
30 | <td align="center"><a href="../../../../people/people.htm">People</a></td> |
---|
31 | <td align="center"><a href="../../../../more/faq.htm">FAQ</a></td> |
---|
32 | <td align="center"><a href="../../../../more/index.htm">More</a></td> |
---|
33 | </table> |
---|
34 | <hr> |
---|
35 | <div class="spirit-nav"> |
---|
36 | <a accesskey="p" href="s04.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../faq.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="s06.html"><img src="../../images/next.png" alt="Next"></a> |
---|
37 | </div> |
---|
38 | <div class="section" lang="en"> |
---|
39 | <div class="titlepage"><div><div><h2 class="title" style="clear: both"> |
---|
40 | <a name="bbv2.faq.external"></a>Can I get output of external program as a variable in a Jamfile? |
---|
41 | </h2></div></div></div> |
---|
42 | <p>From time to time users ask how to run an external program and save |
---|
43 | the result in Jamfile variable, something like: |
---|
44 | </p> |
---|
45 | <pre class="programlisting"> |
---|
46 | local gtk_includes = [ RUN_COMMAND gtk-config ] ; |
---|
47 | </pre> |
---|
48 | <p> |
---|
49 | Unfortunately, this is not possible at the moment. However, if the |
---|
50 | result of command invocation is to be used in a command to some tool, |
---|
51 | and you're working on Unix, the following workaround is possible. |
---|
52 | </p> |
---|
53 | <pre class="programlisting"> |
---|
54 | alias gtk+-2.0 : : : : |
---|
55 | <cflags>"`pkg-config --cflags gtk+-2.0`" |
---|
56 | <inkflags>"`pkg-config --libs gtk+-2.0`" |
---|
57 | ; |
---|
58 | </pre> |
---|
59 | <p> |
---|
60 | If you use the "gtk+-2.0" target in sources, then the properties |
---|
61 | specified above will be added to the build properties and eventually |
---|
62 | will appear in the command line. Unix command line shell processes |
---|
63 | the backticks quoting by running the tool and using its output -- |
---|
64 | which is what's desired in that case. Thanks to Daniel James for |
---|
65 | sharing this approach. |
---|
66 | </p> |
---|
67 | </div> |
---|
68 | <table width="100%"><tr> |
---|
69 | <td align="left"></td> |
---|
70 | <td align="right"><small></small></td> |
---|
71 | </tr></table> |
---|
72 | <hr> |
---|
73 | <div class="spirit-nav"> |
---|
74 | <a accesskey="p" href="s04.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../faq.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="s06.html"><img src="../../images/next.png" alt="Next"></a> |
---|
75 | </div> |
---|
76 | </body> |
---|
77 | </html> |
---|