Boost logo

Boost-Build :

Subject: Re: [Boost-build] Conditional src files
From: Vladimir Prus (ghost_at_[hidden])
Date: 2009-11-05 02:54:05


On Thursday 05 November 2009 Anant Rao wrote:

> Hi Steven, Rene, Philip,
> Thanks to you all!
> Yes, I wanted 'static' and it works like a charm, doing exactly what I want.
>
> I found out why it was not working, based on Steven's first email.
> If I have
>
> Option 1:
>
> F1.cpp
> : <define>$(DEFINES)
> : <link>static
> : <target-os>windows:<source>winfile.cpp ;
>
> Winfile.cpp is not compiled.
>
> Option 2:
> F1.cpp
> : <define>$(DEFINES)
> : <target-os>windows:<source>winfile.cpp
> : <link>static ;
>
> I get a syntax error from bjam.
>
> Option 3:
> F1.cpp
> : <define>$(DEFINES)
> <target-os>windows:<source>winfile.cpp
> : <link>static ;
>
> Works correctly!!
>
> I think using a ':' before <target-os> is the problem. Am I right?

Yes. Please recall that things like 'lib' are just function names.
Then:

   lib libblah
         : F1.cpp
     : <define>$(DEFINES)
      <target-os>windows:<source>winfile.cpp
          : <link>static ;

is a function call. The ":" character separates parameters to that
function. First parameter is the name of the metatarget to create,
second parameter is the list of sources, third parameter is the
requirements and the fourth parameter is the default build. Requirements
are the build properties that must be always present -- so everything
must be in requirements. E.g. the code above has extra ":", and should
be

   lib libblah
         : F1.cpp
     : <define>$(DEFINES)
       <target-os>windows:<source>winfile.cpp
            <link>static ;

- Volodya


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