The best way to deal with this is probably to have a single "sentinel" or "stamp" file that gets generated *every* time the command runs. And then list that file as it's only output that CMake knows about... (But still with the full list of inputs.)<br>
<br><div>Does that work?</div><div><br><div><br><div class="gmail_quote">On Wed, Jan 13, 2010 at 8:26 AM, Michael Wild <span dir="ltr"><<a href="mailto:themiwi@gmail.com">themiwi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi all<br>
<br>
I just ran into an interesting problem. Say I have a custom command that produces several files, but only updates them as needed. E.g.<br>
<br>
add_custom_command(OUTPUT file1.c file2.c file3.c<br>
COMMAND generator file1.inp file2.inp file3.inp<br>
DEPENDS generator file1.inp file2.inp file3.inp<br>
VERBATIM)<br>
<br>
Now, suppose that file2.inp is changed, the build system will run the command to update the output. Now, the "generator" program is really smart and only updates file2.c. This causes all hell to break lose (at least with the GNU Makefile generator on OS X), causing the command to run three times, desperately trying to update file1.c and file3.c (because file2.inp is newer than them) and then, as it seems, gives up. The thing repeats with every invocation of "make".<br>
<br>
Now, the "generator" requires all the input files to be processed in one step, so I can't split the command as one would usually do. Also, touching all the output files after calling "generator" isn't really viable since I'd like to prevent unnecessary re-compilation of the produced .c files.<br>
<br>
<br>
Are there any good solutions to this problem?<br>
<br>
<br>
Michael<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</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>
</blockquote></div><br></div></div>