tags:

views:

173

answers:

2

The default naming convention for the Boost C++ libraries is:

libboost_regex-vc71-mt-d-1_34.lib

where all libraries are built into the same directory. I'd like to modify the build process so that the filename does not contain the target architecture or build type (versions are okay). I want the file to end up in a different directory depending on the architecture being built for:

vc71/debug/libboost-1_34.lib

vc71/release/libboost-1_34.lib

Any idea on how to do this?

A: 

I don't know of any way to do that with the Boost build system, but you could use a fairly simple script to move and rename them without too much difficulty.

On the other hand, with most Windows compilers, you seldom need to concern yourself with the library filenames because, for those libraries that require a separate binary, Boost employs auto-linking:

Most Windows compilers and linkers have so-called “auto-linking support,” which eliminates the second challenge. Special code in Boost header files detects your compiler options and uses that information to encode the name of the correct library into your object files; the linker selects the library with that name from the directories you've told it to search.

Moving and renaming the files would break that.

Head Geek
+2  A: 

You can remove all decoration from the library filenames by passing "--layout=system". Your example above shows "vc71/release" paths -- there's no out-of-box way to get this layout. You can do that with a bit of hackign. In Jamroot, find the 'stage-proper' target, which specifies the location as:

  <location>$(stage-locate)/lib

You can modify that to specify different locations depending on properties, e.g:

  <variant>release:<location>$(stage-locate)/lib/release
  <variant>debug:<location>$(stage-locate)/lib/debug

Please see Boost.Build website for more documentation

Vladimir Prus
Where is --layout documented? I looked all over and I can't find any mention of it.
Gili
It's in the output of "bjam --help". Getting started refers to this options for details.
Vladimir Prus