Boost logo

Boost-Build :

Subject: Re: [Boost-build] How to declare Boost libraries that do auto-linking
From: Ian Emmons (iemmons_at_[hidden])
Date: 2009-05-13 15:22:02


On May 13, 2009, at 11:55 AM, Vladimir Prus wrote:

> On Wednesday 13 May 2009 19:45:44 Vladimir Prus wrote:
>> Ian Emmons wrote:
>>
>>> I am struggling to declare Boost libraries in my site-config.jam
>>> file
>>> for Windows. I would like to use the auto-linking feature to avoid
>>> specifying the library name, something like this:
>>>
>>> searched-lib BoostProgramOptions
>>> : # no sources
>>> : <toolset>msvc
>>> <address-model>64:<search>$(BoostDir)/msvc-64/stage/lib
>>> <address-model>32:<search>$(BoostDir)/msvc-32/stage/lib
>>> : # no default build
>>> : <include>$(BoostDir)
>>> <link>shared:<define>BOOST_PROGRAM_OPTIONS_DYN_LINK
>>> ;
>>>
>>> This does not work, because the searched-lib target generates a
>>> default value for the name feature ("BoostProgramOptions.lib") that
>>> does not exist. What is the proper way to do this?
>>
>> Not the searched-lib -- because it is meant for linking to a library
>> by giving its name on the linker's command line.
>> For autolinking, just add:
>>
>> <address-model>64:<search>$(BoostDir)/msvc-64/stage/lib
>> <address-model>32:<search>$(BoostDir)/msvc-32/stage/lib
>> <include>$(BoostDir)
>>
>> to project requirements (in Jamroot).
>
> s/search/library-path (as Steven say)
>
> - Volodya

That's very nice -- thanks! My library declaration now looks like this:

alias BoostProgramOptions
    : # no sources
    : <toolset>msvc
    : # no default build
    : <include>$(BoostDir)
       <link>shared:<define>BOOST_PROGRAM_OPTIONS_DYN_LINK
       <define>_SCL_SECURE_NO_WARNINGS
       <address-model>64:<library-path>$(BoostDir)/msvc-64/stage/lib
       <address-model>32:<library-path>$(BoostDir)/msvc-32/stage/lib
    ;

This works great if I put BoostProgramOptions into the sources list of
a lib or exe rule. Unfortunately, it doesn't work for a unit-test
rule, because (apparently) the library-path feature is not propagated
to the PATH environment variable when the executable is run. (My unit-
test rule does succeed in building the executable, though.)

Is there a feature that causes a directory to be added to PATH on
Windows or LD_LIBRARY_PATH or its cousins on other platforms?

Thanks,

Ian



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