[CMake] 138% progress when building both all and not-in-all target?

Ben Pope benpope81 at gmail.com
Fri Jun 20 04:24:29 EDT 2014


On Friday, June 20, 2014 12:40 PM, Dan Kegel wrote:
> Seen in the wild today:
>
> [119%] Building CXX object
> CMakeFiles/clownCar.dir/examples_noinst/clownCar.C.o *
> ...
> [138%] Built target examples_noinst
>
> And on another machine, the last report was
>
> [144%] Built target plasmasimple
>
> All were with CMake 2.8.10.2
>
> I see from
> http://www.cmake.org/pipermail/cmake/2007-June/014856.html
> that this has happened in the past, and how it might happen.
>
> In my case, it happened when I did
>     make -j4 all examples_noinst
>
> Is the simple act of building the special 'all' target and a
> target that uses EXCLUDE_FROM_ALL enough to trigger this
> strange behavior?  I haven't checked, but it's a tempting guess.
> - Dan
>
> * Not important to this report, but amusing

I've also seen this using the Makefile generator, the bigger problem is 
that it ends up building the dependencies of those targets in parallel, 
if there is overlap, it may try to build the same target multiple times 
simultaneously, which can obviously break the build

The workaround is to add a (cmake) target that depends on the set of 
targets you want to build in parallel.

Ben




More information about the CMake mailing list