Calling FindQt4 and FindKDE4 multiple times

Alexander Neundorf neundorf at kde.org
Fri Oct 5 17:46:23 CEST 2007


On Thursday 04 October 2007 15:28, David Faure wrote:
> What do you think about this patch?
> It reduces the debug output (and the time, a little bit) when configuring
> extragear from the toplevel. Because it's possible to configure it globally
> or each subdir separately, each subdir calls find_package(KDE4 REQUIRED) so
> the output looks like a large mess with the multiple lines of output
> related "looking for Qt4" and "looking for KDE4" repeated 9 times.
>
> KDE4_FOUND and QT4_FOUND don't go into the cache, so I think this change is
> correct, it only makes a difference when find_package is done multiple
> times. (Maybe cmake itself could remember the packages called, and notice
> "OK I have done find_package(KDE4 REQUIRED) already once, no need to do it
> again"?)


Hmm, not sure.

E.g. in FindQt4.cmake there is a QT_MIN_VERSION, where the user can adjust the 
required version of Qt4.

So e.g. toplevel could do:

set(QT_MIN_VERSION 4.0.0)

while in some other subdir 
set(QT_MIN_VERSION 4.3.0) 
might be used.

The same for the arguments like "REQUIRED", the subcomponents etc., so all 
this needs to be handled by the patch. FindQt4.cmake is already complicated 
enough.

So, what I can say is, that if you commit this, this is a change will not go 
into cmake cvs, because it can break things. I would prefer if the 
FindQt4.cmake versions in KDE and cmake don't get to different (they are 
already different enough now).

So the patch will work in the common case but has the potential to break 
stuff. Is the optimization measurable ?
If it's not significant I'd say due to the potential to break stuff this 
should not be committed.

Bye
Alex

P.S. for the optimization: run cmake with cachegrind. I found that there are 
two "big" functions: one is the parsing (not sure anything can be done there 
since this is generated code) and the other one was something like 
IsSubDirectory(), can't remember exactly right now


More information about the Kde-buildsystem mailing list