[CMake] CMake for many interdependent libraries/executables

Wiser, Tyson TWiser at logostech.net
Wed May 23 14:24:28 EDT 2012


>> We don't modify external dependencies, but we do need to check them 
>> out and build them before building a library or executable that depends on them.
>> Sometimes a developer will be working in a single library or executable.
>> Sometimes he will be working in multiple libraries and/or executables.  
>> You can imagine that for a new developer it becomes very complicated 
>> to know which libraries and executables need to be checked out and in 
>> which order they need to be built in order to satisfy all the 
>> dependencies.  Even established developers that have all the necessary 
>> dependencies checked out and modify a library have trouble knowing 
>> which libraries need to be rebuilt, and in what order, for the change to propagate up to an executable.
>
> How impractical would it be to always check out and build everything?
> How close is an incremental build over the whole tree to "fast enough"?
> - Dan

Some of our external dependencies (e.g. boost) are quite large and can
take a very long time to build.  We also have several different customers
that each get a different set of executables, but those executables all
make use of some subset of the same libraries.  Occasionally we need to
switch from working for one customer to another and it is nice to not
have separate workspaces (and thus avoid duplicate code and data files
on disk).  So the short answer is it is not very practical to always
check out and build everything.

It's hard to say how fast an incremental build is over the whole tree.
It has always been a manual process.  In my example, if I changed liba
I would have to build it, build libb, build libd, and then build exe2.
Each of the individual builds were usually a couple of seconds so I
imagine that an incremental build over the whole tree would just be
a few seconds per node on average (hopefully faster if nothing actually
changed).

I realized that I didn't explicitly mention this, but each library and
executable has its own repository and is currently treated as its own
project as far as the makefiles/VS solution files are concerned.  I
would like to keep it that way but be able to have the option of the
"superbuild" for each project that would take care of the current
project and all its dependencies.  Each depender could thus call each
of its dependees' "superbuild."  I think that would allow a developer
to be able to work on a given library in isolation without needing to
have all the projects that depend on it checked out, yet still allow
another developer working on a different project that depends on that
library to easily check it out and build it.



More information about the CMake mailing list