Boost logo

Boost-Build :

From: Andrey Melnikov (melnikov_at_[hidden])
Date: 2005-08-12 13:43:12


Vladimir Prus wrote:
> Hi,
> I've a use case which is not very well supported by V2 at the moment:
>
> project
> : requirements <library>/some_library_that_takes_long_time_to_build ;
>
> lib runtime1 : main1.cpp common ;
> lib runtime2 : main2.cpp common ;
> lib common : common.cpp : <link>static ;
>
> So, I have some library "common" that I made static to avoid the trouble of
> installing yet another library. However, that library gets project
> requirements too, and so tries to build
> some_library_that_takes_long_time_to_build with <link>static. Now, I don't
> want that at all, not to mention that static library can't be linked with
> another static library.

Do you mean that you want to combine static common.lib with dynamic
/some_library_that_takes_long_time_to_build ?

> However, there's no easy way to avoid this behaviour. I was thinking about
> this:
>
> lib common : common.cpp : local:<link>static ;
>
> to make requirement non-propagated, or about

I think a better idea is to make <link> always non-propagated. What are
the use cases for which you'd like <link> to propagate?

> lib common : common.cpp : <no-project-requirements> ;
>
> to avoid inheriting project requirements or about
>
> lib common : common.cpp
> : -<library>/some_library_that_takes_long_time_to_build
> ;
>
> to selectively disable some of the project requirements.

This is too complicated. I think it would be better to split a project
into several subprojects to selectively disable the requirements.

For small projects this can be complicated, so I'd like an ability to
have multiple projects in a jamfile.

> The latter two can be useful for another use case:
>
> project : requirements <library>util ;
> exe a1 .....
> exe a2 .....
> lib util : util.cpp ;
>
> Now, this does not work, because util tries to build itself recursively.
>

It would be better to write something like this:

project ;
exe a1 ..... util ... ;
exe a2 ..... util ... ;
lib util : util.cpp ;

If you have 100 executables (which is typical if you have each test
isolated in its own binary) it's not a good idea to specify util
dependency 100 times.

So in this case create a separate project for util:

project : <requirement>util-proj/util ;
exe a1 ..... ;
exe a2 ..... ;

project util-proj ;
lib util : util.cpp ;

Andrey

 


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