I have recently been reviewing ways to improve build times for our project, 
which is comprised of a number of static libraries. I stumbled across this post 
on the CMake tracker from 2012/13 (https://cmake.org/Bug/view.php?id=13799 
<https://cmake.org/Bug/view.php?id=13799>). It suggests adding a 
COMPILE_DEPENDS target property to to explicitly set dependencies for STATIC 
libraries instead of always using all linked libraries as build-order 
dependencies.

Having done a draft implementation in a local CMake repository it has shaved 
off  20% of our 120s build time. I expect the savings to be much more dramatic 
when I test with Incredibuild (approximately 50% based on tests done previously 
from just deleting dependencies manually in Visual Studio).

I don’t really want to refactor our code to use “OBJECT” libraries as the 
inability to link with other targets means that propagating compile options / 
include directories etc down the chain of linked libs becomes painful. This 
method allows me to switch between static and shared libs using a config option 
and none of my CMake scripts need to change.

Anyway, I was wondering whether there was any interest in me pushing my 
solution back to Git / submitting a Pull request so that it might be merged in 
at some point. If there is - any advice on any gotchas I might watch for 
instead of just adding some fairly simple code to cmComputeTargetDepends.cxx 
would be gratefully received - especially as this is my first time poking 
around in CMake code.

// John Wordsworth
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake-developers

Reply via email to