[CMake] CMake for many interdependent libraries/executables

Wiser, Tyson TWiser at logostech.net
Tue May 29 10:23:31 EDT 2012


> But ExternalProject still does a checkout, configure and build step. (at least
>  if I read the docs correctly)
>
> our goal was to minimize the amount of stuff you needed to build, specifically,
> if you were only working on 2 libs that were needed by 1 app, you could
> checkout only those 2 libs.
>
> Using ExternalProject would still force a checkout and build of another 20 orso
> libs (in our case) including some that (at least back then) would take 15+
> minuted to build.

Thanks for the replies. The way that I was thinking of using ExternalProject
would not require a checking out every library, if I can get it to work the way
that I think I can. My original posting was an attempt to see if I was completely
off base or if the idea made sense.

Using your example, if I wanted to work only on the one app that needed two libs,
I could check out and build the app.  Due to ExternalProject, the two libs would
also be checked out and built as part of the apps build process, but nothing else
assuming that the two libs didn't have any other dependencies.

Essentially I was hoping that I could structure each project (app or lib) so that
it used ExternalProject only for its direct dependencies.  This would give kind
of a recursive ExternalProject structure.  As a simple example, suppose I want to
work with appA.  appA depends on libA and so appA's CMakeLists.txt file uses
ExternalProject to checkout and build libA.  libA depends on libB and libC and
thus uses ExternalProject in libA's CMakeLists.txt file to checkout and build
libB and libC.  If some other app or lib depends on libD but nothing I am working
with does, then libD will never be checked out or built.  However, if I later
decide to also work on say appB that does depend on libD it would be checked out
and built at that point.  If appB also depended on libA, libB, or libC, it would
recognize that they are already present (because they were dependencies of appA
which I had previously checked out and built) and would use the existing builds
instead of grabbing a new copy.

The main part of my original set of questions was essentially asking if the
scenario I just described is possible and, if so, if it was a good idea.  Does
that in any way clarify things?


More information about the CMake mailing list