# Presets use NUMBER\_OF\_PROCESSORS for number of parallel jobs

**URL:** https://discourse.cmake.org/t/presets-use-number-of-processors-for-number-of-parallel-jobs/4989
**Category:** Usage
**Created:** [February 11, 2022, 12:06pm UTC](https://discourse.cmake.org/t/presets-use-number-of-processors-for-number-of-parallel-jobs/4989 "2022-02-11T12:06:24Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![JuliusCaesar](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/85e7bf/32.png) [@JuliusCaesar](https://discourse.cmake.org/u/JuliusCaesar)
#### Post date: [February 11, 2022, 12:06pm UTC](https://discourse.cmake.org/t/presets-use-number-of-processors-for-number-of-parallel-jobs/4989/1 "2022-02-11T12:06:24Z")

</div>

Hey guys,  
I’m starting to use the CMakePresets.json  
Now for the TestPresets and the BuildPresets we can specify an optional number of build jobs.  
I’d like to run all build with the current number of available processors

```auto
  "buildPresets": [
    {
      "name": "_default_build",
      "hidden": true,
      "jobs": 12
    },
]

```

now If i replace “jobs”: 12 with “jobs”: $env{NUMBER\_OF\_PROCESSORS}  
VS2022 shows a warning that the value of jobs must be an integer.

How can I use the value of NUMBER\_OF\_PROCESSORS for the build presets and test presets?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 14, 2022, 12:25am UTC](https://discourse.cmake.org/t/presets-use-number-of-processors-for-number-of-parallel-jobs/4989/2 "2022-02-14T00:25:22Z")

</div>

@kyle.edwards Is this possible?

I suspect that `0` might be the answer, but I forget if that is “count the processors” or `make`'s “don’t count anything, just keep launching commands” (hopefully the former as the latter is just a complicated forkbomb in practice).

---

<div class="post-metadata">

### Author: ![kyle.edwards](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@kyle.edwards](https://discourse.cmake.org/u/kyle.edwards)
#### Post date: [February 14, 2022, 3:35pm UTC](https://discourse.cmake.org/t/presets-use-number-of-processors-for-number-of-parallel-jobs/4989/3 "2022-02-14T15:35:34Z")

</div>

The `jobs` field is supposed to be an integer, not a string. Unfortunately, that precludes the use of environment variables.

---

<div class="post-metadata">

### Author: ![JuliusCaesar](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/85e7bf/32.png) [@JuliusCaesar](https://discourse.cmake.org/u/JuliusCaesar)
#### Post date: [February 15, 2022, 8:01am UTC](https://discourse.cmake.org/t/presets-use-number-of-processors-for-number-of-parallel-jobs/4989/4 "2022-02-15T08:01:02Z")

</div>

Thank you both for your feedback. I did a little test after Ben’s feedback. For me it looks like job number = 0 feels like j=1 for Makefiles and Ninja

I’ll add this as a feature request though 🙂

---

<div class="post-metadata">

### Author: ![IvanaGyro](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/i/ecccb3/32.png) [@IvanaGyro](https://discourse.cmake.org/u/IvanaGyro)
#### Post date: [March 15, 2025, 2:54pm UTC](https://discourse.cmake.org/t/presets-use-number-of-processors-for-number-of-parallel-jobs/4989/5 "2025-03-15T14:54:10Z")

</div>

For everyone who arrives here. Here is the request: [https://gitlab.kitware.com/cmake/cmake/-/issues/23648](https://gitlab.kitware.com/cmake/cmake/-/issues/23648)
