Hi Tarjei. 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:
add_custom_command( OUTPUT ... #as before COMMAND ... #as before MAIN_DEPENDENCY a.idl DEPENDS b.idl c.idl ... # rest as before ) 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. 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. Petr On Thu, May 8, 2014 at 9:16 AM, Tarjei Knapstad <[email protected]>wrote: > 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: > > a.idl: > -------------------- > #include "b.idl" > #include "c.idl" > --------------------- > > 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. > > Regards, > -- > Tarjei > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake >
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
