Boost logo

Boost-Build :

Subject: Re: [Boost-build] Copying source file required by target
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2018-07-27 13:42:55


AMDG

On 07/27/2018 03:55 AM, Mateusz Loskot via Boost-build wrote:
> On 26 July 2018 at 19:19, Steven Watanabe via Boost-build
> <boost-build_at_[hidden]> wrote:
>> On 07/26/2018 11:08 AM, Mateusz Loskot via Boost-build wrote:
>>> <snip>
>>> make mwe.cpp : mwe.cpp.in : @copy_mwe_if_not_exists ;
>>> actions copy_mwe_if_not_exists { cp $(>) $(<) }
>>> <snip>
>>> How can I force it to create mwe.cpp in the same directory as mwe.cpp.in?
>>>
>>
>>
>> Since you want to put the file in a fixed place,
>> use <location>.
>
> I've fiddled with the property but I must be doing something wrong
>
> make mwe.cpp : mwe.cpp.in : @copy_mwe_if_not_exists <location>. ;
> or
> make mwe.cpp : mwe.cpp.in : <location>. @copy_mwe_if_not_exists ;
>
> also trying to use absolute path instead of dot.
>
> <snip>
>
> Where the <location> should go for the desired effect?
>

$ b2 --help make.make
Rule 'make.make ( target-name : sources * : generating-rule + :
requirements * : usage-requirements * )':

Add a ':' between the rule and <location>.

>>> I have also tried to follow the BBv2 generate example based on
>>> file-target and common.copy action:
>>> https://github.com/boostorg/build/tree/develop/example/generate
>>> But constructing a target seems like an overkill for my purpose.
>>> And, the rule (or common.copy) also creates file in `bin` directory.
>>>
>>>
>>> BTW, I am aware the `copy_mwe_if_not_exists` is incomplete regarding its name:
>>> - it will have to use cp or copy depending on OS
>>
>> common.copy does this already.
>
> I'm simply failing to figure out how to use it in the simple actions {} block.
>

You don't need to create your own action block at
all. Just pass @common.copy to make.

> Do I need to get back to generate rule approach mentioned earlier,
> in order to be able to use common.copy?
>

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