On 10. Sep, 2010, at 15:16 , Ingolf Steinbach wrote: > 2010/9/10 Michael Wild <them...@gmail.com>: >> set(SRCS a.c b.c d.c e.c) >> >> add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/f.c >> COMMAND ... >> DEPENDS ${SRCS} >> COMMENT "Generating f.c" >> VERBATIM) > > Does this also create dependencies on the multitude of header files > included by the .c files in SRCS (which would probably be desired in > case of the OP)? > > Ingolf
No, it will not. But usually you have anyways something like: set(SRCS a.c b.c c.h d.c e.c) set(HDRS a.h b.h c.h d.h e.h) add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/f.c COMMAND ... DEPENDS ${SRCS} ${HDRS} COMMENT "Generating f.c" VERBATIM) list(SRCS APPEND ${CMAKE_BINARY_DIR}/f.c) add_executable(foo ${SRCS} ${HDRS}) You want an explicit list of header files because otherwise they won't show up in your IDE. Also, for libraries you often do: add_library(foo ${SRCS} ${HDRS}) set_targets_properties(foo PROPERTIES FRAMEWORK TRUE PUBLIC_HEADER "${HDRS}") install(TARGETS foo EXPORT Foo-exports RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib PUBLIC_HEADER DESTINATION include) which has the added advantage of automatically installing the headers that belong to the target and also works automagically if you want to build foo as a framework on Mac OS X. Michael -- There is always a well-known solution to every human problem -- neat, plausible, and wrong. H. L. Mencken
PGP.sig
Description: This is a digitally signed message part
_______________________________________________ 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