[CMake] Trouble with parallel builds for targets created by add_executable, target_link_libraries, and add_library

Bill Hoffman bill.hoffman at kitware.com
Tue Sep 29 19:46:03 EDT 2009


Alan W. Irwin wrote:
> On 2009-09-29 16:36-0400 Bill Hoffman wrote:
> 
>> make -j N is only supported with the all target.
> 
> How difficult would it be to implement parallel build support for more than
> just the "all" target? Note, if there is some limitation that makes it
> impractical or inefficient to implement this current "all" target 
> capability
> for every target, you could instead implement this capability just for the
> targets where this capability is wanted (as designated, say, by a
> PARALLEL_BUILD=ON target property).
> 
It is very hard to implement on top of make.  Let me restate what I 
mean, it is not the all target that is special.  You can do make -j N 
target.  You just can't do make -jN target1 target2 if target1 and 
target2 have a common target that they depend on.  You can only specify 
one target at a time for make -j N.  The /fast targets could be used to 
avoid the issue you are having maybe...

make -j2 x01c/fast x02c

Then it will only trace the depends of one of them...  I have not tested 
that but it might work... :)


> I have heard that ctest will soon (2.8.0?) get a parallel test capability.
> Does it also have the same limitation (must run "make all" first) or can 
> you
> have individual ctests dependent on individual targets that can be built in
> parallel?

The build always has to be complete before ctest runs.  The new -j 
option for ctest has nothing to do with that.   It just gives the 
ability to run tests in parallel.
> 
> I just had a look at one of my favorite whitebox sites, and it looks like
> 2-cpu PC's are common for entry-level PC's, and from what I have read, the
> PC manufacturers plan to continue to increase the number of cpu's in their
> PC's rather than the speed of individual cpu's.
CMake/CTest are as parallel as we can make them, and we are aware of the 
   ubiquity of multi-core computers these days.

> 
> Given that computer industry trend, I believe the sooner that CMake and
> Ctest can remove all limitations on parallel builds and tests, the better.
> 

I think we are in pretty good shape.  The makefiles and IDE files build 
parallel for most cases very well.  You just can't tell it to build two 
separate targets that might have a shared depend.   At some point we 
want to create a new program cbuild that will remove the limitations of 
make when you are using the command line and not an IDE build.

-Bill


More information about the CMake mailing list