Boost logo

Boost-Build :

From: jrsr01801 (jrsr369shop_at_[hidden])
Date: 2004-01-22 21:41:50


Below is a mock setup of a project-root.jam file, top level Jamfile,
and subproject Jamfile. The setup works, but being new to bjam I
have a gut feeling there may be an easier/better way to set things

Here are a couple of specific questions:

1) I wrap some code I will be using in many subprojects into a rule
which is defined in project-root.jam. However, to get things to
work I had to make the rule "operate" in the caller's module. Is
this the correct way to do this?
2) The libraries I use in my rule had to be defined in the top
project Jamfile, because I got errors when I tried to put this code
into project-root.jam. Is there a better way to do this?
3) Finally, my files require a custom suffix; in particular, my
shared libraries should not use .so as its suffix, but a different
custom suffix. I used type.set-generated-target-suffix to change
this, but was not sure if this was the correct way to do it.

Any insight would be appreciated. Thanks,


In project-root.jam:
rule my-requirements
local REQS = <include>somepath <cflags>someflag ;
return $REQS ;

rule create-my-target ( target : sources + )
module [ CALLER_MODULE ]
lib $(<) : $(>) : /top//lib1 /top//lib2 /top//lib3 ;
stage dist : $(<) : <variant>release:<location>somepath1 ;
stage dist : $(<) : <variant>debug:<location>somepath2 ;

In project Jamfile:
project top : requirements [ my-requirements ] ;
import type;
type.set-generated-target-suffix SHARED_LIB : : mysuffix ;
lib lib1 : : <name>L1 <search>somepath1 ;
lib lib2 : : <name>L2 <search>somepath2 ;
lib lib3 : : <name>L3 <search>somepath3 ;
obj common_file : common_file.c ;

In subproject Jamfile:
create-my-target mylib : source1.c source2.c ;


Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at