[cmake-developers] CMake strips MAKEFLAGS from environment

Brad King brad.king at kitware.com
Thu May 21 10:14:06 EDT 2015


On 05/21/2015 09:31 AM, Taylor Braun-Jones wrote:
> gmake[1]: warning: jobserver unavailable: using -j1.  Add `+' to parent make rule.

I don't think that is caused by the MAKEFLAGS removal I linked.
The code I linked does not run during 'cmake --build'.  It only
runs while configuring a project to protect try_compile.

The problem is that make does not pass MAKEFLAGS when invoking a tool
it does not think is 'make'.  For example:

-----------------------------------------------------------------------------
$ cat env.make
all:
	@env make -f env.make other

other:
	@echo MAKEFLAGS='$(MAKEFLAGS)'

$ make -j2 -f env.make other
MAKEFLAGS= -j --jobserver-fds=3,4

$ make -j2 -f env.make all
make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
MAKEFLAGS=w
-----------------------------------------------------------------------------

You could try using "+env" as your COMMAND instead, though I wouldn't
consider this an officially supported approach.

-Brad



More information about the cmake-developers mailing list