cmake and parallel building with "make -jN"

Roman Dmitrienko picture Roman Dmitrienko · May 31, 2010 · Viewed 13.5k times · Source

I'm trying to setup a parallel CMake-based build for my source tree, but when I issue

$ cmake .
$ make -j2

I get:

jobserver unavailable: using -j1.  Add '+' to parent make rule

as a warning. Does anyone have an idea if it is possible to fix it somehow?

Answer

apenwarr picture apenwarr · Nov 21, 2010

In the generated Makefile, when calling into a sub-make it needs to either use $(MAKE) (not just 'make') or else precede the line with a +. That is, a rule should look like this:

mysubdir:
    $(MAKE) -C mysubdir

or like this:

mysubdir:
    +make -C mysubdir

If you don't do it one of those two ways, make will give you that warning.

I don't know anything about cmake, so maybe it's generating Makefiles that aren't correct. Or maybe you did something incorrectly on your end.