Hi,<br><br><div class="gmail_quote">On Mon, May 7, 2012 at 10:00 PM, Miller Henry <span dir="ltr">&lt;<a href="mailto:MillerHenry@johndeere.com" target="_blank">MillerHenry@johndeere.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">







<div>
<font face="Calibri, sans-serif">
<div> </div>
<div>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)</div>
<div> </div>
<div>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?</div></font></div></blockquote><div><br></div><div>
One option would be to not use the QT_USE_FILE and instead have target_link_libraries list all the Qt libraries individually. The FindQt4.cmake module provides a variable for each Qt library it finds, so you can decide for each target against which Qt components to link this particular target. </div>
<div><br></div><div>Andreas</div></div>