[CMake] How would I use parallel make on ExternalProjects?

kent williams nkwmailinglists at gmail.com
Fri Oct 8 11:57:09 EDT 2010


I think what I'm doing isn't clear to you.

I have a CMakeLists.txt that is essentially 'sourceless' -- it defines
a bunch of CMake variables, and then builds a bunch of prerequisites
and applications added with ExternalProject_add. It doesn't have any
add_subdirectory,add_executable, add_library etc of its own.

So at build time, the process tree is

make # the make of the top level
         make # build external project 1
             .
             .
         make # build external project n

If I use make -j4, for example, it would build 4 external projects in
parallel with make -j1.  If any of those projects is on the critical
path, and takes significantly longer to build than any other projects,
the build process bottlenecks doing the sequential build of that one
project.

My method -- changing the build command for the external projects to
use -j4 for example, will instead do a sequential series of parallel
sub-makes, instead of a parallel series of sequential submakes.

I've tried it both ways and this is how it works.

For the gentleman who suggested distcc -- thanks but no thanks for
these reasons: 1) it's something else to add to a very long list of
prerequisites for our software and 2) it requires a mostly homogenous
network of computers to farm compiles out to.  We have, by design, a
heterogenous network of OS X and different Linux versions, so that
we're testing on as many platforms as possible.


On Thu, Oct 7, 2010 at 11:29 AM, Bill Hoffman <bill.hoffman at kitware.com> wrote:
> ITK will not do a sequential build.  The -j N gets passed down to all the
> sub projects as well. It will run N build rules at the same time from VTK,
> ITK and everything else.    Just like it was all one big project...
>


More information about the CMake mailing list