[CMake] CMake 3.7.2 and parallel builds

Dan Liew dan at su-root.co.uk
Sun Jan 29 12:11:47 EST 2017


> What's weirder (and I forgot to mention) is that if I just build the project
> normally outside of my regression testing script (ie. "make -j5"), I don't
> get the jobserver warning.

The reason for this error message from make is given at [1].

I've seen something like this before when my build used "Unix
Makefiles" as the generator and the build invoked an external build
system as a `add_custom_command()` that also used makefiles to do its
build.

The problem was that make (in the outer most build system, i.e. the
CMake generated) one was setting the `MAKEFLAGS` environment variable
to do communicate various bits of information to handle recursive
makefiles (see [2]). This works fine until the CMake generated
makefiles invoked the external build system with `MAKEFLAGS` being
set.

My solution was to strip `MAKEFLAGS` out of the environment when
invoking the `make` command externally.

This isn't exactly your problem but it may help you figure out what is
wrong. My guess is that the sub-make isn't being invoked correctly.

[1] https://www.gnu.org/software/make/manual/html_node/Error-Messages.html
[2] https://www.gnu.org/software/make/manual/html_node/Options_002fRecursion.html


More information about the CMake mailing list