<div dir="ltr">the commands are done sequentially... or you could invent fictional target names based on the filename, and chain current to prior <div><br></div><div>(I guess if you used -j 4 or something the commands might not be sequential)</div>
<div>is there a way to force 1 job?</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 28, 2014 at 10:43 AM, j s <span dir="ltr"><<a href="mailto:j.s4403@gmail.com" target="_blank">j.s4403@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The i<br>
<div class="">On Mon, Apr 28, 2014 at 11:44 AM, J Decker <<a href="mailto:d3ck0r@gmail.com">d3ck0r@gmail.com</a>> wrote:<br>
> foreach( file ${files} )<br>
> ADD_CUSTOM_COMMAND(<br>
> ...<br>
> COMMAND cpp -P -CC -DDPI_EXTERN ${file} >><br>
> ${FILEEXTERN}.tmp \; done'<br>
> )<br>
><br>
<br>
</div>Unfortunately that doesn't work for me since all of the individual<br>
files are writing to the same file. The output file is<br>
non-deterministic in content and subject to race conditions. I would<br>
need a foreach loop in the custom command itself to ensure that the<br>
files are properly ordered. Is anything like this possible?<br>
<br>
ADD_CUSTOM_COMMAND(<br>
OUTPUT ${FILEEXTERN}.tmp<br>
FOREACH(I ${FILES})<br>
COMMAND cpp -P -CC -DDPI_EXTERN ${I} >> ${FILEEXTERN}.tmp \; done'<br>
ENDFOREACH(I ${FILES})<br>
DEPENDS ${FILES}<br>
)<br>
<br>
Regards,<br>
<br>
Juan<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
><br>
><br>
><br>
> On Mon, Apr 28, 2014 at 9:05 AM, j s <<a href="mailto:j.s4403@gmail.com">j.s4403@gmail.com</a>> wrote:<br>
>><br>
>> Through trial and error, I've found that I can do the following to<br>
>> escape a variable in a custom command.<br>
>><br>
>> ADD_CUSTOM_COMMAND(<br>
>> ...<br>
>> COMMAND bash -c 'for i in ${FILES}\; do cpp -P -CC -DDPI_EXTERN $$i >><br>
>> ${FILEEXTERN}.tmp \; done'<br>
>><br>
>> ...<br>
>> )<br>
>><br>
>><br>
>> Is this the proper way to escape a variable that needs to make to the<br>
>> shell command level? I'm assuming this would only work through a Unix<br>
>> Makefile? Is there an alternative to iterating over a variable in a<br>
>> custom command?<br>
>> --<br>
>><br>
>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>><br>
>> Please keep messages on-topic and check the CMake FAQ at:<br>
>> <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
>><br>
>> Kitware offers various services to support the CMake community. For more<br>
>> information on each offering, please visit:<br>
>><br>
>> CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
>> CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
>> CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
>><br>
>> Visit other Kitware open-source projects at<br>
>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>><br>
>> Follow this link to subscribe/unsubscribe:<br>
>> <a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
><br>
><br>
</div></div></blockquote></div><br></div>