Opened 17 years ago
#195 new enhancement
Add support for flags with a composite value.
| Reported by: | Owned by: | somebody | |
|---|---|---|---|
| Priority: | minor | Milestone: | M13 |
| Component: | component1 | Version: | 2.0 |
| Keywords: | flag composite feature property value | Cc: |
Description
Add support for flags constructing their value from a some fixed string part as well as one or more feature values.
Currently it is possible to define a flag that uses a fixed predefined string as its value:
toolset.flags compile.action MY_FLAG <some-feature> : --my-fixed-compiler-option ;
Or it is possible to define a flag that uses a feature's value as its own using either of the following:
toolset.flags compile.action MY_FLAG <some-feature> ; toolset.flags compile.action MY_FLAG <condition>xxx : <feature-whose-value-we-want> ;
But it is not possible to define a flag that would take a property like <template-depth>128 and construct '-ftemplate-depth-128' as its value.
As a workaround one can make the flag take only the property's value as its own and then add whatever text to it is needed to construct a proper command-line option in the action using the tool's value.
As I see it this support would not bring all that much to Boost Build except possibly some interface completeness. The only thing I can think off is that one could prepare a flag suitable for multiple actions and then not duplicate the code for constructing the actual command-line option in each of those actions. For an example see gcc.compile.c++ & gcc.compile.c++.pch rules in Boost Build's tools/gcc.jam toolset module.
I believe the key to implementing this feature is defining the syntax used to define such flags and then modifying the toolset.handle-flag-value rule accordingly.
If & when this support is added it can be used to merge existing flags like TEMPLATE_DEPTH into more generic ones like OPTIONS where they do seem to fit in nicely and have not already been merged with them only due to this missing support.
