Re: Copying source file required by target

Mateusz Loskot via Boost-build <[email protected]>
Newsgroups gmane.comp.lib.boost.build
Message-ID <CABUeae99CKqXYZZ-1sg-e6JPPG6Z9TKtD3YL2EV+c56at5yz6Q@mail.gmail.com>
On 27 July 2018 at 15:42, Steven Watanabe via Boost-build
<[email protected]> 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
>> <[email protected]> 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
_______________________________________________
Unsubscribe & other changes: https://lists.boost.org/mailman/listinfo.cgi/boost-build
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.