Boost logo

Boost-Build :

Subject: Re: [Boost-build] bjam - two outputs from the same file
From: Renaud Lepère (renaud.lepere_at_[hidden])
Date: 2010-06-04 04:06:38


Rao, Anant a écrit :
> Hi,
>
>
>
> If I have a source file that generates two types of output, is it
> possible to generate them using bjam?
>
>
>
> Say, foo.cpp is like this:
>
>
>
> void f()
>
> {
>
> }
>
>
>
> #if defined(EXE)
>
> int main()
>
> {
>
> f();
>
> }
>
> #endif
>
>
>
> Now, using the same file, I want to generate a binary (by defining EXE)
> as well as a lib.
>
>
>
> How do I declare the targets in a bjam file?
>

You could probably use something like :
obj foo_1.obj : foo.cpp : <define>EXE ;
obj foo_2.obj : foo.cpp ;
exe foo : foo_1.obj ;
lib foolib : foo2_obj ;
see
http://www.boost.org/doc/libs/1_40_0/doc/html/bbv2/faq.html#id2146448
for more details

Perhaps you can also split your cpp file into 2 files :
foo.cpp and foo_exe.cpp and avoids #defines

Renaud


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