Boost logo

Boost-Build :

Subject: Re: [Boost-build] Copying source file required by target
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2018-07-27 16:34:38


On 27 July 2018 at 15:42, Steven Watanabe via Boost-build
<boost-build_at_[hidden]> wrote:
> 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 * )':

I should have remembered to ask b2 for help :)
I've been trying quite sincerely to learn it from
https://boostorg.github.io/build/manual/develop/index.html

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

Works, of course.

>>>> 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.

Heh, that is simple indeed!

Thank you

Best regards,

-- 
Mateusz Loskot, http://mateusz.loskot.net

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