On Tuesday 08 September 2009, Wojciech Migda wrote:
> > Why not include it in the foo target, instead of making a new
>
> a_h_gen target and doing extra dependencies manually?
>
> Firstly, we have hundred of source files which may indirectly depend
> generated source files, so we want such information to be covered by
> cmake dependency scanner itself - the problem is that there is no link
> between the library target and the header target.
>
> By no means we want to specify such dependencies manually - that would
> be a nightmare.

If you mean by specifying manually adding the generated header files manually 
to the targets, this can be made much easier with the support of some macro:

macro(generate_stuff srcs )
   ...
   add_custom_command(OUTPUT foo.h ...)
   ...
   set( ${srcs} ${${srcs}} foo.h)
endmacro()


set(mySrcs main.cpp bar.cpp)
generate_stuff(mySrcs template1.xml template2.xml)

add_executable(hello ${mySrcs} )

We are using that a lot e.g. in KDE4.

Alex
_______________________________________________
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

Reply via email to