wildcards in DEPENDS

Matthias Kretz kretz at kde.org
Wed Nov 26 10:43:42 CET 2008


On Tuesday 25 November 2008 22:35:34 Alexander Neundorf wrote:
> 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.

Hmm, I found the macro also in the cmake installation dir as the FindQt4 
shipping with cmake also uses it.

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

Yes it works most of the time except for make target/fast there's a race and 
it breaks sometimes.
So actually this part of the patch is not directly related to the 
automoc4_init change.

> 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.

Ah, I thought cmake would still read the automoc code only once.

> 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()).

I used if(AUTOMOC4_INIT_FILE) now, that should be suffiently safe and a bit 
easier, ok?

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

I don't know. I'd like the Windows people to give the non-Windows code another 
try and hopefully we can remove the special casing for Windows again.

> 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)

It's hard to do that without creating new races. (Think of the user hitting 
Ctrl+C at the most inconvenient point in time.) And what would happen if two 
or more automoc4 processes write to the file at the same time?

Also the current implementation seems reasonably fast (kdelibs: 3ms, kdebase: 
4ms, phonon: 0ms. After 'echo 3 > /proc/sys/vm/drop_caches': kdelibs: 77ms, 
kdebase: 260ms, phonon: 27ms.)

-- 
________________________________________________________
Matthias Kretz (Germany)                            <><
http://Vir.homelinux.org/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: automoc_init2.patch
Type: text/x-patch
Size: 6828 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-buildsystem/attachments/20081126/b4876b4c/attachment.patch 


More information about the Kde-buildsystem mailing list