Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-07-28 02:37:08


> import feature : feature set-default ;
> import os ;
>
> feature target-os : solaris linux : implicit symmetric ;
>
> local os-name = [ os.name ] ;
> feature.set-default target-os : $(os-name:L) ;

One more note. The above line will only work with CVS version of Boost.Build.
Since sourceforge will show that version on anonymous servers with some delay,
I attach a patch that should be applied.

- Volodya
 --Boundary-00=_kKNJ/v2z1ITwUJ2 Content-Type: text/x-diff;
charset="iso-8859-1";
name="set-default.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="set-default.diff"

Index: new/feature.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/new/feature.jam,v
retrieving revision 1.45
diff -u -r1.45 feature.jam
--- new/feature.jam 21 Jul 2003 05:16:47 -0000 1.45
+++ new/feature.jam 28 Jul 2003 07:34:11 -0000
@@ -127,9 +127,23 @@
$(attributes).features += $(name) ;

.all-features += $(name) ;
- extend $(name) : $(values) ;
+ extend $(name) : $(values) ;
}

+# set default value of the given feature, overriding any previous
+# default.
+rule set-default ( feature : value )
+{
+ local f = [ grist $(feature) ] ;
+ if ! $(value) in $($(f).values)
+ {
+ errors.error "The specified default value, '$(value)' is invalid"
+ : "values values are " $($(f).values) ;
+ }
+ $(f).default = $(value) ;
+}
+
+
# return the default property values for the given features.
rule defaults ( features * )
{
@@ -142,7 +156,7 @@
}
else
{
- result += $(f)$($(f).values[1]) ;
+ result += $(f)$($(f).default) ;
}
}
return $(result) ;
@@ -369,6 +383,12 @@

.all-implicit-values += $(values) ;
}
+ if ! $($(feature).values)
+ {
+ # This is the first value specified for this feature,
+ # take it as default value
+ $(feature).default = $(values[1]) ;
+ }
$(feature).values += $(values) ;
}

@@ -964,6 +984,12 @@
<toolset>gcc <variant>debug <stdlib>native <dummy>dummy1
: add-defaults <runtime-link>static <define>foobar <optimization>on <toolset>gcc:<define>FOO
;
+
+ set-default <runtime-link> : static ;
+ assert.result <runtime-link>static
+ : defaults <runtime-link>
+ ;
+

assert.result <toolset>gcc <define>foo <stdlib>stlport <magic>3 <include>/path/to/stlport <define>MAGIC=3
: run-actions <toolset>gcc <define>foo <stdlib>stlport <magic>3
 --Boundary-00=_kKNJ/v2z1ITwUJ2--


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