Yes I knew for the GENERATED option. <br><br>This solution is a good work-around but still, it would be nice if CMake could handle the situation this way:<br><br># Generate Java / XML binding files <br>add_custom_command(<br>
  OUTPUT  ${CMAKE_CURRENT_BINARY_DIR}/src/*.java<br>  COMMAND ${JAVA_PATH}/xjc ${CMAKE_SOURCE_DIR}/xsd/*.xsd<br>  DEPENDS ${CMAKE_SOURCE_DIR}/xsd/*.xsd<br>  COMMENT &quot;Invoking xjc to generate Java binding files&quot;)<br>
<br>The OUTPUT, DEPENDS could handle regex strings.<br><br>What do you think?<br><br>Cheers,<br><br><div class="gmail_quote">2010/1/18 Michael Wild <span dir="ltr">&lt;<a href="mailto:themiwi@gmail.com">themiwi@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Yes, it worked for me.<br>
<br>
But, as I already mentioned, be careful to mark the files as GENERATED and add them to the ADDITIONAL_MAKE_CLEAN_FILES directory property. One caveat is, however, that if you delete any of the output files, CMake won&#39;t regenerate them unless you also delete the stamp file (or that one is out-of-date).<br>

<br>
Also, if your custom output depends on compiler flags, you&#39;ll probably want to include ${CMAKE_CFG_INTDIR} in the output-paths to support multi-configuration IDE&#39;s. This can be tricky to do if you use wrapper-cmake scripts, because the IDE&#39;s expand the variable at build-time and only if they see it on the command line, so you have to make sure it shows up there...<br>

<font color="#888888"><br>
Michael<br>
</font><div><div></div><div class="h5"><br>
On 18. Jan, 2010, at 15:56 , Romain CHANU wrote:<br>
<br>
&gt; Hi Michael.<br>
&gt;<br>
&gt; I got the same situation here. I am using a command which outputs a lot of<br>
&gt; files (&gt;100 files).<br>
&gt;<br>
&gt; Have you tried what David is suggesting?<br>
&gt;<br>
&gt; Thank you to update us.<br>
&gt;<br>
&gt; Cheers,<br>
&gt;<br>
&gt; 2010/1/13 Michael Wild &lt;<a href="mailto:themiwi@gmail.com">themiwi@gmail.com</a>&gt;<br>
&gt;<br>
&gt;&gt; Hmmm, thought of something like that myself, but am not sure whether<br>
&gt;&gt; dependencies will be handled correctly. Of course, I&#39;ll have to label the<br>
&gt;&gt; products as GENERATED and add them to  ADDITIONAL_MAKE_CLEAN_FILES. Will<br>
&gt;&gt; give it a try...<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Michael<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On 13. Jan, 2010, at 16:17 , David Cole wrote:<br>
&gt;&gt;<br>
&gt;&gt;&gt; The best way to deal with this is probably to have a single &quot;sentinel&quot; or<br>
&gt;&gt;&gt; &quot;stamp&quot; file that gets generated *every* time the command runs. And then<br>
&gt;&gt;&gt; list that file as it&#39;s only output that CMake knows about... (But still<br>
&gt;&gt; with<br>
&gt;&gt;&gt; the full list of inputs.)<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Does that work?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Wed, Jan 13, 2010 at 8:26 AM, Michael Wild &lt;<a href="mailto:themiwi@gmail.com">themiwi@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Hi all<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; I just ran into an interesting problem. Say I have a custom command that<br>
&gt;&gt;&gt;&gt; produces several files, but only updates them as needed. E.g.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; add_custom_command(OUTPUT file1.c file2.c file3.c<br>
&gt;&gt;&gt;&gt; COMMAND generator file1.inp file2.inp file3.inp<br>
&gt;&gt;&gt;&gt; DEPENDS generator file1.inp file2.inp file3.inp<br>
&gt;&gt;&gt;&gt; VERBATIM)<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Now, suppose that file2.inp is changed, the build system will run the<br>
&gt;&gt;&gt;&gt; command to update the output. Now, the &quot;generator&quot; program is really<br>
&gt;&gt; smart<br>
&gt;&gt;&gt;&gt; and only updates file2.c. This causes all hell to break lose (at least<br>
&gt;&gt; with<br>
&gt;&gt;&gt;&gt; the GNU Makefile generator on OS X), causing the command to run three<br>
&gt;&gt; times,<br>
&gt;&gt;&gt;&gt; desperately trying to update file1.c and file3.c (because file2.inp is<br>
&gt;&gt; newer<br>
&gt;&gt;&gt;&gt; than them) and then, as it seems, gives up. The thing repeats with every<br>
&gt;&gt;&gt;&gt; invocation of &quot;make&quot;.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Now, the &quot;generator&quot; requires all the input files to be processed in one<br>
&gt;&gt;&gt;&gt; step, so I can&#39;t split the command as one would usually do. Also,<br>
&gt;&gt; touching<br>
&gt;&gt;&gt;&gt; all the output files after calling &quot;generator&quot; isn&#39;t really viable since<br>
&gt;&gt; I&#39;d<br>
&gt;&gt;&gt;&gt; like to prevent unnecessary re-compilation of the produced .c files.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Are there any good solutions to this problem?<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Michael<br>
&gt;&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt;&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Visit other Kitware open-source projects at<br>
&gt;&gt;&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Please keep messages on-topic and check the CMake FAQ at:<br>
&gt;&gt;&gt;&gt; <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt;&gt;&gt; <a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt;<br>
&gt;&gt; Visit other Kitware open-source projects at<br>
&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt;<br>
&gt;&gt; Please keep messages on-topic and check the CMake FAQ at:<br>
&gt;&gt; <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
&gt;&gt;<br>
&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; <a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
&gt;&gt;<br>
<br>
</div></div></blockquote></div><br>