[CMake] Problems with parallel builds

Denis Scherbakov denis_scherbakov at yahoo.com
Thu Nov 18 10:18:45 EST 2010


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

--- On Thu, 11/18/10, David Cole <david.cole at kitware.com> wrote:

> From: David Cole <david.cole at kitware.com>
> Subject: Re: [CMake] Problems with parallel builds
> To: "Denis Scherbakov" <denis_scherbakov at yahoo.com>
> Cc: cmake at cmake.org
> Date: Thursday, November 18, 2010, 6:43 AM
> Try:
> ADD_CUSTOM_TARGET(MyHeaders ALL DEPENDS MyFile.hh)
> 
> Without the "ALL" your target is not included in the set of
> targets
> built by a "make" or a "make all" -- without your target
> included in
> "make" there is nothing for the subsequent targets to
> depend on.
> Perhaps we should add a warning to add_dependencies if
> expressing a
> dependency on something not in "all" by default....
> 
> 
> On Thu, Nov 18, 2010 at 9:33 AM, Denis Scherbakov
> <denis_scherbakov at yahoo.com>
> wrote:
> > Hi, David,
> >
> > I did as you suggested:
> >
> > ADD_CUSTOM_COMMAND(OUTPUT MyFile.hh ...)
> > ADD_CUTSOM_TARGET(MyHeaders DEPENDS MyFile.hh)
> >
> > ADD_LIBRARY(MYLIB ${MYLIB_SRCS})
> > ADD_DEPENDENCIES(MYLIB  MyHeaders)
> >
> > ADD_LIBRARY(MYLIBpic ${MYLIB_SRCS})
> > ADD_DEPENDENCIES(MYLIBpic  MyHeaders)
> >
> > Didn't work. Target "MyHeaders" is build two times
> when I do "gmake -j2"
> > I see two "Generating MyFile.hh" lines and MyFile.hh
> has duplicate lines.
> >
> > Denis
> >
> >> David Cole wrote:
> >>
> >> The easiest way to make this work is to have a
> separate
> >> custom target
> >> that depends on the output of the custom command,
> and then
> >> to have the
> >> two libraries depend on that custom target with
> >> add_dependencies...
> >>
> >
> >
> >
> >
> 


      


More information about the CMake mailing list