[CMake] Problems with parallel builds

Alan W. Irwin irwin at beluga.phys.uvic.ca
Thu Nov 18 13:45:29 EST 2010


On 2010-11-18 07:18-0800 Denis Scherbakov wrote:

> David,
>
> Thank you for spending your time to resolve my problem.
>
> Unfortunately you suggestion did not help.
>
> Introduction of new custom targets in my case leads to the fact that
> I have one custom target that depends on another custom target. I get:
>
> gmake[3]: *** No rule to make target 'customTargetA', needed by 'customTargetB'.  Stop.
>
> And in this case it is not even a parallel build.
>
> Now I remember that I already tried this custom-target trick about
> a year ago and it failed with "gmake" error I specified above.
>
> So CMake is not parallel build ready.
> BTW, "gmake -j4 targetA targetB" also fails. You need to "gmake -j4 targetA"
> and then "gamake -j4 targetB" to get correct results.

Denis:

I have been following this discussion with interest and assumed you
would quickly find the source of your parallel build issue.

I assure you cmake is parallel build ready, i.e., lots of
people including me use parallel builds with cmake with no problems
for quite complex builds. It is not completely trivial to set it up
right for a given complex project, but it can be done.

Since you are having problems with setting it up right for your
complex project, I suggest you try making the simplest example of your
issue: a generated one-line header and two simple libraries (each with
only a few lines of code) that depend upon it.  Then wrap that simple
example up in a tarball so others can verify the issue you are finding
(or make the fix to your simple example so that it works properly with
parallel builds).

The other big advantage of the "simple example" approach is that 99
times out of 100 (at least in my case) the simple example works fine
and it turns out the source of the problem is the implementation of
the logic of the simple example isn't done consistently in the complex
project (e.g., some third library you forgot about also depends on
your generated header) or there is some other CMake logic in
your complex project that needs changing to make your project
ready for parallel builds.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list