Auto-generated XML interfaces and dependencies

Alexander Neundorf neundorf at kde.org
Mon Jan 14 22:41:28 CET 2008


On Saturday 12 January 2008, Thomas McGuire wrote:
> Hello,
>
> On Saturday 29 December 2007, Alexander Neundorf wrote:
> > I guess then one way would be to add a helper target
> > add_custom_target(CREATE_DBUS_STUFF)
> > which creates all the dbus xml interfaces, and have all the targets which
> > need these interfaces depend on this helper target.
> >
> > OTOH, if other targets need some part of what is built when kmail is
> > being built, then it doesn't seem to be that wrong to make them depend on
> > kmail (or the helper target).
>
> That sounds like a good idea. I don't know enough about CMake to do this
> myself though, can anyone help?
>
> I tried the following in the KMail CMake file:
> >add_custom_target( kmail_xml,
> >                   COMMAND qt4_generate_dbus_interface( kmkernel.h
> > org.kde.kmail.kmail.xml OPTIONS -a ) COMMAND qt4_generate_dbus_interface(
> > kmcomposewin.h org.kde.kmail.mailcomposer.xml OPTIONS -a ) )
>
> But that seems to be invalid syntax.

Yes.
COMMAND must be a system command/executable, not a cmake command. 
In CMake commas aren't used to separate arguments, simple whitespace is used 
instead.
You can't call commands inside commands.

Would the following be good enough ?
add_dependencies(kontact_kmailplugin kmail)


Otherwise (I guess you don't want to insert the cmake code for 
qt4_generate_dbus_interface in your CMakeLists.txt) you need to do something.

1.) First add the macros for generating the files:
qt4_generate_dbus_interface(...)
qt4_generate_dbus_interface(...)

2.) create a target which depends on these generated files:

add_custom_target(kmail_xml ALL
                  DEPENDS <generatedfile1> <generatedfile2> ...
                  COMMENT "helper target for xml stuff")

3.) add the dependency to that target:

add_dependencies(kontact_kmailplugin kmail_xml)

Let me know if that doesn't work, I didn't actually test it.

Bye
Alex


More information about the Kde-buildsystem mailing list