Boost logo

Boost-Build :

From: Phillip Seaver (phil_at_[hidden])
Date: 2006-09-20 08:48:13


K. Noel Belcourt wrote:
> Hi,
>
> I'd like to invoke a bjam built executable in an actions. For
> example, I have an exe target, xmlc,
>
> exe xmlc : source ;
>
> that I'd like to use in an actions but I don't know how to reference
> xmlc in the actions. Also, is there some way to make an actions
> depend on a target so that the executable will be built before the
> actions that invokes the executable is run?
>
> Thanks.
>
> -- Noel Belcourt

Here's something that I use. It may not be the best way to do things,
but it works for me. :-)

    exe bin2c : bin2c.c ;
    make Splash.h : bin2c Splash.png : bin2c_run ;
    actions bin2c_run
    {
        $(>[1]) $(>[2-]) $(<)
    }

The "make" command here creates Splash.h using bin2c and Splash.png as
source files with bin2c_run as the commands to run. Since it's using
the target "bin2c" as a source file, it has to build it first, so it
compiles bin2c before trying to run it. :-)

"actions bin2c_run" gets the full path of the bin2c executable as the
first item in the source argument "$(>[1])" and uses the rest of the
source arguments "$(>[2-])" and the output argument "$(<)" as the
arguments to bin2c, so on Windows you get a command like:

    bin\msvc-7.1\debug\link-static\threading-multi\bin2c.exe Splash.png
    msvc-7.1\debug\link-static\threading-multi\Splash.h

HTH,

Phillip


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk