Boost logo

Boost-Build :

Subject: [Boost-build] one target for all build configurations
From: Mikhail Levin (svarneticist_at_[hidden])
Date: 2011-10-22 21:16:10


Hello boost-builders,

I understand that similar issues have already been discussed. It is
still not clear to me, however.

I often need to generate files that are dependencies for other
targets. These files are same for debug/release, static/shared, etc.
configurations. I want to generate them at the specific location, no
more than once, as required by other targets.

Here is an example of a library that uses a generated header:

lib my_lib : lib.cpp : <implicit-dependency>generated.hpp ;
make generated.hpp : $(may_be_empty) : @generate_hpp :
<location>out/include/my_lib ;
rule generate_hpp ( out * : in * : prop * ) { s on $(<) = "//write
some stuff" ; }
actions generate_hpp { @($(STDOUT):E=$(s)) > "$(<)" }

This produces:
error: Duplicate name of actual target ...
because Boost.build wants to make separate generated.hpp for shared
and for static. The error goes away if I remove the <location>
property, but then generated.hpp will be re-generated for every build
configuration. It may seem okay to make half-dozen identical small
headers, but what if I need to transform the whole source tree of some
library?

How can I state that generated.hpp should be made only once and used
for all configurations of my_lib?

Mikhail


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