[CMake] Partial 3rd-party library management

Oliver Smith osmith at playnet.com
Sun Feb 26 20:41:52 EST 2012


In order to maximize our ability to rebuild an exact copy of a previous 
revision, our repository carries copies of numerous 3rd party libraries.

However, in most of their cases we are fairly selective about which 
elements we build.

Downside: "make clean && make" winds up rebuilding all the damn libraries :)

At the same time, we have a large number of customized project-wide 
customizations, depending on which client / product version we're 
building for. So, when we are building - as opposed to developing - we 
need the ability to easily perform a full rebuild, including possibly 
the libraries.

For a nominal development "clean" build, upto 70% of the build time is 
spent building 3rd party libraries.

Right now - for simplicity - we actually assemble the 3rd libraries from 
the top level CMakeLists.txt directly (ok, simplicity and a failure on 
my part to work out how to express that "libraryXXX.a" is an output of 
"subfolderX").

/The problem/

Something like a source-control revert can sometimes put /our/ part of 
the code base into a state that requires a clean. However, we don't want 
to cause the libraries to rebuild /except/ when someone changes 
compilation flags or forces a rebuild of the libraries somehow else 
(e.g. a "cleanall" target).

Is there a way to do this with cmake? Or is this problem only because I 
haven't (yet) split these libraries into their own CMakeLists files?

The simplest and therefore easiest complete example I have is:

8x --- snip --- x8
   add_library(ircclient SHARED libircclient/src/libircclient.c)
   set_property(TARGET ircclient PROPERTY COMPILE_DEFINITIONS 
IN_BUILDING_LIBIRC)
   link_directories( ${Project_BINARY_DIR}/ircclient )
8x --- snip --- x8


- Oliver

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120226/9175d093/attachment.htm>


More information about the CMake mailing list