Boost logo

Boost-Build :

From: Johan Nilsson (r.johan.nilsson_at_[hidden])
Date: 2006-01-20 02:51:04


Matthew Herrmann wrote:
> Hi All,
>
> I'm setting up a library structure where each library lives in its
> own folder, with an accompanying unit test in the "test" subfolder.
> When the library builds, I also build a unit test using the boost
> framework.
>
> The problem I have is that when the user imports the project, say,
> "hello", they will pull in all the link dependencies of the unit test
> as well. This is problematic using Boost's unit test framework since
> it links in libraries that _must_ only be used by unit test programs.
>
> Some solutions I've thought of but dislike are :
>
> * separate project for unit test : defeats cohesion

Why does it defeat cohesion? I usually lay out my libraries something along
the lines of this:

<proj-root>
    ...
    src
        libs
            foo
                # common Jamfile for foo would go here
                foolib
                    # Jamfile for foolib would go here
                    include
                        foo # if separate namespace
                    src
                    ...
                footest
                    # Jamfile for footest would go here
                    src
                    ...

> * change all clients to link to project using "hello//hello" syntax :
> ugly and flimsy

 You could always hide it, and use a variable to access the actual value -
e.g. $(HELLO_LIB).

> * add aliases for every library used : maintenance and centralization
> issue

Doesn't using aliases simplify maintenance? If the location and/or
definition of the lib change, you'll only have to change the alias
definition in a single place. I'm not sure what you mean by centralization
though.

[snip rest]

// Johan


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