<div><div dir="auto">Our case is pretty simplified in that almost every executable uses the dependent DLLs/SOs I need copied. For C# apps it is log4net, NDesk.Options, etc. For native apps it’s fmpeg shared libraries.</div></div><div dir="auto"><br></div><div dir="auto">So when I create the list at configure time, I immediately just use CMake to copy the files the where I want them in the build tree. This guarantees that they are copied the one time when CMake is run instead of at build time.</div><div dir="auto"><br></div><div dir="auto">A few things that make this work for us:</div><div dir="auto"><br></div><div dir="auto">* These libraries are checked into our repo so they aren’t changed by automatically pulling new binaries or anything like that.</div><div dir="auto"><br></div><div dir="auto">* We only have a handful of these dependent 3rd party libs, like 7.</div><div dir="auto"><br></div><div dir="auto">* Couldn’t think of a better way to do it.</div><div dir="auto"><br></div><div dir="auto">If you did want to move it to build time instead of configure time, you’d just have to make a custom target that every other target depends on. In some systems this isn’t easy but if you write wrappers around creating targets then you can do extra book keeping when a target is create. In this case, you just add another depends on the custom target that copies the dependent libs.</div><div dir="auto"><br></div><div dir="auto">-Caleb</div><div><br><div class="gmail_quote"><div dir="ltr">On Sat, Dec 8, 2018 at 7:14 PM Olivier Croquette <<a href="mailto:ocroquette@free.fr">ocroquette@free.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 2018-7-12 15:16, J. Caleb Wherry wrote:<br>
>> in one of our projects, we use copy_if_different to copy some DLLs<br>
>> required by the runtime. It's called as post-build action. The problem<br>
>> is that several targets want to copy the same DLLs, and when using<br>
>> parallelized builds, the different "cmake -E copy_if_different" can<br>
>> conflict, leading the whole build to fail.<br>
>><br>
>> I see two options to fix this:<br>
>><br>
>> 1. don't use copy_if_different, but a custom tool that can deal with the<br>
>> concurrency<br>
>><br>
>> 2. instead of adding post-build actions to different targets, fill up a<br>
>> list containing all the files required, and add a single post-build<br>
>> action to a single target that copies all the required files in one go<br>
>><br>
>> What do you think?<br>
> Had the same problem and went with #2<br>
<br>
Hi Caleb,<br>
<br>
could you give some more details how you did this? Filling up the list <br>
is easy, but I am not sure how to define the final action that will copy <br>
all the DLLs, and make sure it happens only once. Did you define a new <br>
custom target for that?<br>
<br>
<br>
</blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Sent from my iPhone SE</div>