Boost logo

Boost-Build :

Subject: [Boost-build] Use feature value as part of library path/name
From: Bart³omiej Chalfen (Bartlomiej.Chalfen_at_[hidden])
Date: 2011-09-19 11:30:51


Hi,

In my project I have created two custom features, that, aside from
other uses, serve to choose proper library from several available
versions.
I delibaretly chose feature values to match the parts of paths to the
library and would like to use them in 'lib' target definition.

Definition of features in Jamroot.jam:

import feature : feature ;
feature platform : WinX86 LinuxX86 LinuxPPC : propagated ;
feature configuration : WMP_FCMD TDD_FCMD WMP_FCT TDD_FCT : propagated
composite ;

I have created this form of declaring lib targets:

lib FoundationModel : : <platform>WinX86 <configuration>WMP_FCMD
<file>$(LIB_PATH)/WinX86_WMP_FCMD/FoundationModel.lib ;
lib FoundationModel : : <platform>WinX86 <configuration>TDD_FCMD
<file>$(LIB_PATH)/WinX86_TDD_FCMD/FoundationModel.lib ;
lib FoundationModel : : <platform>WinX86 <configuration>WMP_FCT
<file>$(LIB_PATH)/WinX86_WMP_FCT/FoundationModel.lib ;
lib FoundationModel : : <platform>WinX86 <configuration>TDD_FCT
<file>$(LIB_PATH)/WinX86_TDD_FCT/FoundationModel.lib ;
lib FoundationModel : : <platform>LinuxX86 <configuration>WMP_FCMD
<file>$(LIB_PATH)/LinuxX86_WMP_FCMD/FoundationModel.lib ;
lib FoundationModel : : <platform>LinuxX86 <configuration>TDD_FCMD
<file>$(LIB_PATH)/LinuxX86_TDD_FCMD/FoundationModel.lib ;
lib FoundationModel : : <platform>LinuxX86 <configuration>WMP_FCT
<file>$(LIB_PATH)/LinuxX86_WMP_FCT/FoundationModel.lib ;
lib FoundationModel : : <platform>LinuxX86 <configuration>TDD_FCT
<file>$(LIB_PATH)/LinuxX86_TDD_FCT/FoundationModel.lib ;

And it works, but to me it is quite ugly solution, especially when I
have to add new configuration (besides, this is not the only lib that
I have to declare this way).

I'm looking for some more compact solution, that would make use of the
fact, that feature values form parts of path.
I tried something similar to what I use in the 'actions' rule:

flags FoundationModel PLATFORM : <platform> ;
flags FoundationModel CONFIGURATION : <configuration> ;
lib FoundationModel : :
<file>$(LIB_PATH)/$(PLATFORM)_$(CONFIGURATION)/FoundationModel.lib ;

But this does not seem to work - bjam binds to the
"FoundationModel.lib" file without specifying the path at all, and the
linker can't find this file.

Is there a way to use feature values in 'lib' target declaration?

--
Bart³omiej Chalfen
GG: 2585725
JID: charfa_at_[hidden]

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