<div dir="ltr"><div><div><div><div><div><div><div>Hi Tarjei.<br><br></div>add_custom_command() has a DEPENDS argument where you can list any number of files which will act as dependencies for the custom command. So you could extend your custom command like this:<br>
<br></div>add_custom_command(<br></div> OUTPUT ... #as before<br></div> COMMAND ... #as before<br></div> MAIN_DEPENDENCY a.idl<br></div> DEPENDS b.idl c.idl<br></div> ... # rest as before<br><div><div><div><div><div>
)<br><br></div><div>You have to keep in mind that this gets processed at configure time - if you change the #include-s used in a.idl, you have to modify the CMakeList and re-run CMake to get the changes picked up.<br></div>
<div><br></div><div>It should also be possible to use the IMPLICIT_DEPENDS argument of add_custom_command() to request the C or C++ dependency scanner to run on the file, moving the dependency detection to build time. But that only works for Makefile generators.<br>
<br>Petr<br></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 8, 2014 at 9:16 AM, Tarjei Knapstad <span dir="ltr"><<a href="mailto:tarjei.knapstad@gmail.com" target="_blank">tarjei.knapstad@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">In our project we are generating code from CORBA IDL files by adding a custom command that generates C++ code from the IDL files and a library target that depends on the generated output. This works as expected, however IDL supports include directives which are (naturally) not picked up as dependencies by CMake. To give an example:<div>
<br></div><div>a.idl:</div><div>--------------------</div><div>#include "b.idl"</div><div>#include "c.idl"</div><div>---------------------<br></div><div><br></div><div>Here the file a.idl file includes b.idl and c.idl. The file a.idl is given as input to the custom command that processes IDL files into C++, but if I change b.idl or c.idl then the target is not rebuilt. Is it possible to add b.idl and c.idl as explicit dependencies in some way so that my target is rebuilt if these files change? I've made various attempts with add_custom_target() and add_dependencies() as well as set_source_files_properties() without any luck.</div>
<div><br></div><div>Regards,</div><div>--</div><div>Tarjei</div></div>
<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: <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 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 <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></blockquote></div><br></div></div></div></div></div></div></div></div>