views:

291

answers:

1

We currently use the `lib' like this to introduce an external pre-built library into a project:

lib ace_lib_static : : <name>libboost_ace-vc80-mt-sgd.lib <variant>debug <toolset>msvc <address-model>64
                <search>../lib/ACE_wrappers/lib64
                ;
lib ace_lib_static : : <name>libboost_ace-vc80-mt-s.lib <variant>release <toolset>msvc <address-model>64
                <search>../lib/ACE_wrappers/lib64
                ;

lib ace_lib_static : : <name>libboost_ace-vc80-mt-sgd-5_6_8.lib <variant>debug <toolset>msvc 
    <search>../lib/ACE_wrappers
    ;

lib ace_lib_static : : <name>libboost_ace-vc80-mt-s-5_6_8.lib <variant>release <toolset>msvc 
    <search>../lib/ACE_wrappers
    ;

project myProject
: requirements <include>.
<include>../lib/ACE_wrappers
<define>ACE_AS_STATIC_LIBS
...

To use ace_lib_static properly in the project, we have to copy the block into the jamfile of the project. Note that it defines the filename, search directory, include directory and macro. And this is for VC 8.0 only. If we add support for other compilers the block is even bigger.

Is there any better way to introduce an external prebuilt lib in boost.build? Ideally we want to have a separate jamfile that the project jamfile can reference, and add a couple of lines to make it available to the project.

+2  A: 

You can create a new file called Jamroot in any directory, containing the 'lib' definitions above. Then, your project can do:

   use-project /ace : <location-to-that-directory> ;

   exe a : a.cpp : /ace//ace_lib_static ;

I would also recommend that you add ../lib/ACE_wrappers to the usage requirements, so that referring to /ace//ace_lib_static will add includes automatically.

HTH, Volodya

Vladimir Prus