Calling FindQt4 and FindKDE4 multiple times

David Faure faure at kde.org
Thu Oct 4 21:28:24 CEST 2007


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

Index: FindKDE4Internal.cmake
===================================================================
--- FindKDE4Internal.cmake      (revision 721171)
+++ FindKDE4Internal.cmake      (revision 721172)
@@ -212,6 +212,9 @@
 # Redistribution and use is allowed according to the terms of the BSD license.
 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.

+if(KDE4_FOUND)
+  # Already found in this cmake run, nothing more to do
+else(KDE4_FOUND)

 include (MacroEnsureVersion)

@@ -972,3 +975,6 @@ if (NOT _kde4_uninstall_rule_created)
    add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake")

 endif (NOT _kde4_uninstall_rule_created)
+
+endif(KDE4_FOUND)
+

--- FindQt4.cmake       (revision 721171)
+++ FindQt4.cmake       (revision 721172)
@@ -181,6 +181,10 @@
 # Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.
 # See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.

+if (QT4_QMAKE_FOUND)
+   # Check already done in this cmake run, nothing more to do
+
+else (QT4_QMAKE_FOUND)

 INCLUDE(CheckSymbolExists)
 INCLUDE(MacroAddFileDependencies)
@@ -1241,4 +1245,5 @@ ELSE(QT4_QMAKE_FOUND)
    ENDIF(Qt4_FIND_REQUIRED)

 ENDIF (QT4_QMAKE_FOUND)
+ENDIF (QT4_QMAKE_FOUND)



-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).


More information about the Kde-buildsystem mailing list