On 07/25/2011 03:24 PM, Micha Renner wrote: > There is following sequence: > > ADD_EXECUTEABLE(generator gen.c) > > ADD_CUSTOM_COMMAND(OUTPUT tlib.h > COMMAND generator > tlib.h) > > ADD_LIBRARY(tlib tlib.c tlib.h) > > The question: Is it sure that ADD_EXECUTEABLE is invoked before the > library is build or is here an ADD_DEPENDENCIES(tlib generator) > necessary? > > Greetings > > Micha >
Yes, CMake should recognize that "generator" is a target and create the dependency of tlib.h on "generator" automagically. And since it knows that tlib.h is GENERATED, it will also add a dependency of tlib on tlib.h. If you want to make really sure that CMake understands that "generator" is a target, use generator expressions, like "$<TARGET_FILE:generator>", but that works only since 2.8.4. HTH Michael _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake