# Disable Parallel builds or enforce specific Targets are not built in parallel

**URL:** https://discourse.cmake.org/t/disable-parallel-builds-or-enforce-specific-targets-are-not-built-in-parallel/6922
**Category:** Usage
**Tags:** os:linux
**Created:** [November 21, 2022, 7:58pm UTC](https://discourse.cmake.org/t/disable-parallel-builds-or-enforce-specific-targets-are-not-built-in-parallel/6922 "2022-11-21T19:58:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![developer](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/d/bcef8e/32.png) [@developer](https://discourse.cmake.org/u/developer)
#### Post date: [November 21, 2022, 7:58pm UTC](https://discourse.cmake.org/t/disable-parallel-builds-or-enforce-specific-targets-are-not-built-in-parallel/6922/1 "2022-11-21T19:58:18Z")

</div>

I’m using CMake to wrap some Make builds by creating some custom targets that simply call a shell script which invoke `make`. These existing Make builds are in source builds. I now have two different ways I wish to call make on the existing Make builds. If I run CMake without any parallel options, this works as desired (I’m using GNU Makefile generation). However, if someone where to pass parallel build option, this would break. Effectively I need to ensure these two custom targets aren’t built in parallel, or disable the option to have parallel builds. Is there something I can do to accomplish this?

---

<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: [November 22, 2022, 12:14am UTC](https://discourse.cmake.org/t/disable-parallel-builds-or-enforce-specific-targets-are-not-built-in-parallel/6922/2 "2022-11-22T00:14:07Z")

</div>

I think the only reliable way is to make one depend on the other. With `Ninja` generators, you can add them to the same [job pool](https://cmake.org/cmake/help/latest/prop_gbl/JOB_POOLS.html) with size 1, but that doesn’t work for any other generator.

---

<div class="post-metadata">

### Author: ![ocroquette](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/o/dbc845/32.png) [@ocroquette](https://discourse.cmake.org/u/ocroquette)
#### Post date: [November 28, 2022, 5:29pm UTC](https://discourse.cmake.org/t/disable-parallel-builds-or-enforce-specific-targets-are-not-built-in-parallel/6922/3 "2022-11-28T17:29:53Z")

</div>

I am not sure if this is an option in your case, but in general, as a workaround, you can write a CMake script that does the sequential work using execute\_process, and execute it as add\_custom\_command(COMMAND ${CMAKE\_COMMAND} -P …)
