Boost logo

Boost-Build :

Subject: Re: [Boost-build] Sorting include headers
From: Phillip Seaver (phil_at_[hidden])
Date: 2008-10-15 11:44:03


Alexander Sack wrote:
> As per FAQ:
>
> http://www.boost.org/doc/tools/build/doc/html/bbv2/faq/s04.html
>
> The boost build system seems to sort header files. Is there any way
> to turn that off completely? I know a long shot but to be honest,
> this is a very very (VERY) annoying feature of bjam. It should
> preserve the order in which is specified on the command line (I don't
> see why internally it needs to do this).
>

>From http://lists.boost.org/boost-build/2004/08/7084.php

> Some more information. The properties are sorted for performance
> reasons. We do quite a lot of work with property sets and try to cache
> results. For caching to really help, differences in order should be
> erased:
> "<variant>release <debug-symbols>on" and "<debug-symbols>on
> <variant>release" are exactly the same.

As I understand it, the property sets are just strings (or lists of
strings), so if they're not sorted, they would have to either sort
before comparing or check each item in one set against the items in the
other set. Property sets are usually *much* longer than the simple
example above, so it can make a very substantial difference, especially
for large project trees.

> In a prior thread, it was recommended I can use alias but again, how
> do ensure the order of includes is preserved (and for my production
> PROJECT it does matter - I'm not going to rewrite source just yet to
> avoid obvious namespace collisions, the current build just puts the
> includes in the right order and things compile).

The same kind of problem has hit us a few times. I usually try to fix
the code, because it just seems like a never-ending problem otherwise.
It can be a pain, but so are "random" compile problems when the order of
headers changes or a new library comes in with the same name.

Unfortunately, I don't have an easy solution for the ordering problem.
You could probably do something like take all the relative paths,
convert them to full paths (in bjam), and join them with "&&". I don't
know off the top of my head how to write that, though.

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