[CMake] speeding up FIND_PACKAGE(Qt4 ...)

Rolf Eike Beer eike at sf-mail.de
Mon May 7 17:31:33 EDT 2012


Am Montag, 7. Mai 2012, 15:00:24 schrieb Miller Henry:
> We have a cmake based project where cmake runtime is becoming a problem:
> everytime a CMakeLists.txt changes the build takes an extra 40-50 seconds. 
> Our main CMakeLists.txt contains a lot of ADD_SUBDIRECTORY (and little
> else).   Most of the subdirectories then call FIND_PACKAGE(Qt4) with
> various required components.  We have found that by moving this call into
> the top cmake we can save around 20 seconds.  However there is objection to
> doing this because some executables don't need all the qt components.   
> (In particular I object to linking QtTest into production code)
> 
> Is there a way to do the Find package once, and then find individual
> components for link and include purposes separately?  Is there a better way
> so solve this problem?

Use set(QT_USE_QTTEST FALSE) and any other useful combination before 
include(${QT_USE_FILE}) in the subdirectories. That should work.

Eike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120507/23d74eac/attachment.pgp>


More information about the CMake mailing list