Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is an old version of boost. Click here for the latest version's documentation home page.
PrevUpHomeNext

Can I get output of external program as a variable in a Jamfile?

From time to time users ask how to run an external program and save the result in Jamfile variable, something like:

local gtk_includes = [ RUN_COMMAND gtk-config ] ;

Unfortunately, this is not possible at the moment. However, if the result of command invocation is to be used in a command to some tool, and you're working on Unix, the following workaround is possible.

 alias gtk+-2.0 : : : :
         <cflags>"`pkg-config --cflags gtk+-2.0`"
         <inkflags>"`pkg-config --libs gtk+-2.0`"
     ;

If you use the "gtk+-2.0" target in sources, then the properties specified above will be added to the build properties and eventually will appear in the command line. Unix command line shell processes the backticks quoting by running the tool and using its output -- which is what's desired in that case. Thanks to Daniel James for sharing this approach.


PrevUpHomeNext