Boost logo

Boost-Build :

Subject: Re: [Boost-build] linking against external librarys
From: Gevorg Voskanyan (v_gevorg_at_[hidden])
Date: 2010-12-08 13:12:32


"HarrievA_at_[hidden]" wrote:
>Hey Guys,
>
>I want to link all my programs against one library. When i'm in a subdirectory i
>
>get the error: "Unable to find file or target named"...
>
>This is what my Jamroot looks like:
>lib boostsystem : : <name>boost_system ;
>explicit boostsystem ;
>project : default-build release
> : requirements <cxxflags>"-std=gnu++0x"
> : requirements <include>.
> : requirements <library>boostsystem
> : build-dir ./bin
> ;
>#exe sertest : samples/sertest.cpp ;
>build-project samples ;
>
>The samples/Jamfile contains only the line:
>exe sertest : sertest.cpp ;
>
>By typing bjam I get the errormessage:
>error: Unable to find file or target named
>error: 'boostsystem'
>error: referred from project at
>error: 'samples'
>
>When I uncomment the secondlast line of the Jamrootfilie, and comment the
>lastline, my sampleapplication compiles with no error. I know that this is not

>the way to link against boost, but this is only an example... I tried so much.

>Adding a slash( and much more) to the <library> argument... It works too when I
>
>add the dependency ../boostsystem to the samples/Jamfile-line, but thats the
>thing i want to avoid with the default rule...
>
>I don't know where the problem is.

Consider your samples/Jamfile had this instead:
exe sertest : sertest.cpp : <library>boostsystem ;
This wouldn't work because boostsystem is not a target name visible in
samples/Jamfile. In your case <library>boostsystem comes from the parent
project's requirements rather than being specified explicitly, but the behavior
is the same.

>I read so much documentation, and it is so
>frustrating. Maybe I'm to stupid too get the concept behind boost-bind. I had
>so many problems with setting different compileroptions, crosscompilation,
>seting the linkingpath....

I think you meant boost-build instead of boost-bind.
Well, if you have difficulties with Boost.Build, this list is the proper place
to ask your questions, so feel free to ask them.

>I hope someone can help me...

There are several ways to solve this problem, two of which are:

Option 1. Have the following alias declaration in samples/Jamfile:
alias boostsystem : ..//boostsystem ;

Option 2. Give the top project a name, and use that name in the requirement:
project myproject : default-build release
        : requirements <cxxflags>"-std=gnu++0x"
        : requirements <include>.
        : requirements <library>/myproject//boostsystem
        : build-dir ./bin
        ;

Warning: I typed this directly in email client, so there may be some errors.

>Regards, Hendrik,

HTH,
Gevorg


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