# External project does not use parallel jobs

**URL:** https://discourse.cmake.org/t/external-project-does-not-use-parallel-jobs/3359
**Category:** Code
**Created:** [May 18, 2021, 8:18am UTC](https://discourse.cmake.org/t/external-project-does-not-use-parallel-jobs/3359 "2021-05-18T08:18:56Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![cmak](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/c/eb8c5e/32.png) [@cmak](https://discourse.cmake.org/u/cmak)
#### Post date: [May 18, 2021, 8:18am UTC](https://discourse.cmake.org/t/external-project-does-not-use-parallel-jobs/3359/1 "2021-05-18T08:18:56Z")

</div>

I have an external project created with ExternalProject\_Add, but this target is always being built with only one thread. Why doesn’t cmake pass the jobs flag to the external project build system?

---

<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: [May 18, 2021, 6:30pm UTC](https://discourse.cmake.org/t/external-project-does-not-use-parallel-jobs/3359/2 "2021-05-18T18:30:17Z")

</div>

What is the `BUILD_COMMAND` for the project in question?

---

<div class="post-metadata">

### Author: ![cmak](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/c/eb8c5e/32.png) [@cmak](https://discourse.cmake.org/u/cmak)
#### Post date: [May 19, 2021, 10:19am UTC](https://discourse.cmake.org/t/external-project-does-not-use-parallel-jobs/3359/3 "2021-05-19T10:19:39Z")

</div>

The project is built using ninja -j12. But the external project is being built by make (CMAKE\_GENERATOR “Unix Makefiles”). Of course passing BUILD\_COMMAND ${MAKE} -j12 works. But I want it to be built with same number of jobs as passed on command line.

---

<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: [May 19, 2021, 10:33am UTC](https://discourse.cmake.org/t/external-project-does-not-use-parallel-jobs/3359/4 "2021-05-19T10:33:09Z")

</div>

There’s no way to access that information during a build. Ninja does not include a jobserver either, so `make` can’t share the job pool.

The best things available are:

- If using the Makefiles generator and `make` internally, pass no `-j` flags and let the environment communicate the job server information.
- If using Ninja (or any other non-Makefiles generator) is involved, pass explicit `-j` flags to the ExternalProject’s `make` command. I would recommend making a cache variable to allow for tuning this count.
