[CMake] requiring parallel building but sequential linking

Craig Scott craig.scott at crascit.com
Sun Feb 17 18:00:53 EST 2019


On Mon, Feb 18, 2019 at 9:35 AM Domen Vrankar <domen.vrankar at gmail.com>
wrote:

> Hi,
>
> I'm building llvm project with CMake.
> While build process is compiling the code I prefer running "make -j3" on
> my 4 core pc (bumping processor to 100% on 3 of 4 cores and using up ~5 GB
> of ram - part of it is system and not build related).
> While build process is linking I must run "make" with a single job because
> otherwise I run out of memory (cores do little work but ram usage goes past
> 23 GB).
>
> Currently I'm handling this so that I first run "make -j3" and once I get
> to about 90% (first larger linking) I hit ctrl+c and run "make".
>
> Is there a feature in CMake that would support handling this transition of
> parallel builds, sequential linking out of the box?
> (while I'm mostly interested in Linux/make support, having the same
> feature for Windows/nmake/ninja through the same command line cmake command
> would be even better)
>

This is available for Ninja with the JOB_POOL_LINK
<https://cmake.org/cmake/help/latest/prop_tgt/JOB_POOL_LINK.html> target
property, the default for which can be set project-wide with the
CMAKE_JOB_POOL_LINK
<https://cmake.org/cmake/help/latest/variable/CMAKE_JOB_POOL_LINK.html>
variable.
You can control the number of parallel jobs for a given pool with the
JOB_POOLS <https://cmake.org/cmake/help/latest/prop_gbl/JOB_POOLS.html> global
property.


-- 
Craig Scott
Melbourne, Australia
https://crascit.com

Get the hand-book for every CMake user: Professional CMake: A Practical
Guide <https://crascit.com/professional-cmake/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190218/4b86f8e0/attachment.html>


More information about the CMake mailing list