wildcards in DEPENDS

Alexander Neundorf neundorf at kde.org
Tue Nov 25 22:35:34 CET 2008


On Thursday 20 November 2008, Matthias Kretz wrote:
> On Thursday 20 November 2008 10:27:11 Matthias Kretz wrote:
> > Now, for some reason qt4_generate_moc stopped working for me. I don't see
> > how that could be related, if it is and you have an idea please take a
> > look.
>
> It seems I found the problem:
> the OBJECT_DEPENDS I added in Automoc4Config overwrites the OBJECT_DEPENDS
> from qt4_generate_moc. I changed automoc to also use
> macro_add_file_dependency now and kdelibs compiles again.
>
> New atuomoc patch attached. I'd like to commit this, please review.

Ok, some comments.

The macro macro_add_file_dependencies() is only available in kdelibs/ and 
projects using kdelibs/, i.e. it shouldn't be used in automoc. The macro is 
in kdelibs/cmake/modules/MacroAddFileDependencies.cmake, you can just copy 
it.

But, why is this dependency required now ? Currently the source files don't 
depend on the automoc-generated file and it works ?

About the add_custom_target(automoc4_init): this is done now unconditionally. 
I.e. if you do find_package(Automoc4) twice, it will be executed twice, cmake 
will then complain about the target being added twice.
So you should test wether the target has already been added.
With CMake >= 2.6.2 you can do 
if(NOT TARGET automoc4_init)
 ...

With version before that you can do 
get_target_property(AUTOMOC4_INIT_TYPE automoc4_init TYPE)
if the target has already been created, you will get "UTILITY" as result 
(which is TRUE if tested in an if()), and "AUTOMOC4_INIT_TYPE-NOTFOUND" if it 
hasn't been created yet (which is false if tested with if()).

Is it still necessary to have different versions for Windows and non-Windows ?

Instead of putting all files into automoc4_init.files on every cmake run, 
could you do it similar to as you did it before ?
I.e. instead if touching the file in the add_custom_command(), add that 
filename to automoc4_init.files, so in the next make, the automoc4_init 
target will just touch these files and not all ?
This could be done by adding that to the automoc4 executable or by executing 
an additional command in the same add_custom_command (echo should work)

Alex


More information about the Kde-buildsystem mailing list