[CMake] Does Makefile generated by CMake support make -jN?

Chuck Atkins chuck.atkins at kitware.com
Wed Jul 13 15:50:20 EDT 2016


>
> Thanks for your analysis for me Andrew. I can't use "-j" options, i think
> the

reason is the project i dealed with is not parallel. Thus when i use "make
> -jN", it couldn't work correctly every time. Obviously it caused by the
> Makefile generated by CMake, so i wonder if there are some CMake options to
> use CPU effectively.


This usually means missing dependencies the CMakeLists.txt files.  Because
of this you get unpredictable results when compiling in parallel.  Check
your dependencies on targets, link lines, and source files and make sure
they are all correct and not missing anything.



> Because i found when i use already exist Makefile, just
> use "make", it used about 480% CPU.


The Makefile is probably explicitly adding a fixed number of -j options.
CMake will not do this and instead rely on the user to call make with their
desired appropriate level of parallelism.



> And when i use CMake generated Makefile, it just uesd about 96% CPU. The
> "hardware acceleration" i said means how to
> CPU more effectively in CMake.
>

-jN is as good as it gets for make.  That being said, you can always try a
different generator, like Ninja, which tends to have quite a bit better
build times in parallel.

First things first though, you need to get your dependency problem squared
away.  That's the underlying cause of why your parallel builds with -j are
unpredictable.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160713/80339602/attachment.html>


More information about the CMake mailing list