Re: Copying source file required by target

Steven Watanabe via Boost-build <[email protected]>
Newsgroups gmane.comp.lib.boost.build
Organization Providere Consulting, Inc.
Message-ID <[email protected]>
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
> <[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 * )':

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