|
Boost-Build : |
From: Kostas Kostiadis (kos_at_[hidden])
Date: 2006-04-24 08:19:06
That's exactly what I was after...Thx Phillip!
I will try this later today...
While I was looking around for a global place to define certain settings,
I came across site-config.jam.
It's currently blank...Any ideas what site-config.jam is used for?
Is that a good place to put things like:
project root : requirements <variant>debug:<define>SOME_GLOBAL_DEFINE ;
or is it better if I do this in project-root.jam?
cheers,
K.
-----Original Message-----
From: boost-build-bounces_at_[hidden]
[mailto:boost-build-bounces_at_[hidden]] On Behalf Of Phillip Seaver
Sent: 24 April 2006 12:00
To: Boost.Build developer's and user's list
Subject: Re: [Boost-build] global defines based on build type
Kostas Kostiadis wrote:
>
> Hello all,
>
>
>
> The quick version of my question:
>
>
>
> Where is the best place to specify global defines that are then
> propagated to all sub-projects?
>
> For example, I need to have something like:
>
>
>
> requirements <variant>debug:<define>ENABLE_ASSERTS
>
>
>
> that will be true for ALL projects under a certain root directory.
>
You can add a "project" rule to the Jamfile or Jamroot in that top-level
directory that specifies that, like:
project root : requirements <variant>debug:<define>ENABLE_ASSERTS ;
In my Jamroot.jam, I have a project rule that does global requirements
like that. There are no build rules (like "exe", "lib", etc.) in there,
so it doesn't build anything, but the requirements get propagated to all
the child projects.
> The long version of my question (explained by example):
>
> Say I have a UTILS lib (in its own folder with its own Jamfile) and
> one of its source files has something along the lines of:
>
>
>
> #ifdef ENABLE_ASSERTS
>
> #define ASSERT OutputSomeMessageAndHalt
>
> #else
>
> #define ASSERT NothingFunction
>
> #endif
>
>
>
> In this lib (i.e. UTILS) the Jamfile has something like
>
>
>
> project UTILS
>
> : requirements <variant>debug:<define>ENABLE_ASSERTS
>
> ;
>
>
>
> Now say I have another lib, call it MATH, which uses the UTILS lib.
>
> Because I can't specify the order things are build, ASSERT ends up
> being the NothingFunction during debug builds of the MATH lib.
>
>
>
> The only way I found of "fixing" this, is by adding this
>
> : requirements <variant>debug:<define>ENABLE_ASSERTS
>
>
>
> to project MATH in the math lib Jamfile as well...
>
> This is quite bad because it means I'll have to define ENABLE_ASSERTS
> in all the other Jamfiles for all libs and projects that want to use it.
>
> What is the best way to deal with this problem? Is defining
> ENABLE_ASSERTS globally somewhere the best solution?
>
> If so, how can I do this?
>
On the other hand, if all you need to do is make sure all users of the
UTILS library have that defined, I'd do it in the UTILS Jamfile:
project UTILS
: requirements <variant>debug:<define>ENABLE_ASSERTS
: usage-requirements <variant>debug:<define>ENABLE_ASSERTS
;
Then you can have, e.g., "use-project /UTILS : path/to/UTILS ;" in a
higher-level Jamfile, and add /UTILS to the source of the MATH lib:
lib MATH : math.c /UTILS ;
That will cause the usage requirements of UTILS to be applied to MATH.
Hope this helps,
Phillip
_______________________________________________
Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost-build
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