Boost logo

Boost-Build :

Subject: Re: [Boost-build] MATCH regular expression question.
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2015-11-08 16:25:35


AMDG

On 11/06/2015 02:37 PM, Aparna Kumta wrote:
> On 11/06/15 13:29, Steven Watanabe wrote:
>> On 11/06/2015 02:22 PM, Aparna Kumta wrote:
>>> actions link.dll bind LIBRARIES
>>> {
>>> if [ MATCH "(std)" : $(OPTIONS) ]
>>> {
>> You can't use MATCH inside an action block.
>> The body is literal text passed to the
>> shell. The only processing that Boost.Build
>> does is variable expansion.
> Can MATCH be used outside the action block as follows?
>

This is syntactically correct, but doesn't
do what you want. (OPTIONS is not defined
at file scope.) I would suggest putting
this logic inside a forwarding rule:

rule link.dll ( targets * : sources * : properties * )
{
  if [ MATCH "(std)" : [ on $(targets) return $(OPTIONS) ] ]
  {
    link.dll.std $(targets) : $(sources) ;
  }
}

actions link.dll.std bind LIBRARIES
{
  ...
}

Actually, looking at your original problem,
there's no need for separate action blocks:

rule link.dll ( targets * : sources * : properties * )
{
  if [ MATCH "(std)" : [ on $(targets) return $(OPTIONS) ]
  {
    STDLIBOPT on $(targets) = -library=stdcpp,CrunG3 ;
  }
}

actions link.dll bind LIBRARIES
{
  ... -G $(STDLIBOPT) "$(>)" ...
}

STDLIBOPT will then expand to nothing when it
isn't needed.

> if [ MATCH "(std)" : $(OPTIONS) ]
> {
> actions link.dll bind LIBRARIES
> {
> "$(CONFIG_COMMAND)" $(OPTIONS) -L"$(LINKPATH)"
> -R"$(RPATH)" -o
> "$(<)" -h$(<[1]:D=) -G -library=stdcpp,CrunG3 "$(>)"
> "$(LIBRARIES)"
> -Bdynamic -l$(FINDLIBS-SA) -Bstatic -l$(FINDLIBS-ST)
> -B$(LINK-RUNTIME)
> }
> }
> else
> {
>
> actions link.dll bind LIBRARIES
> {
> ...
> }
> }
>

In Christ,
Steven Watanabe


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