# cmake --job

**URL:** https://discourse.cmake.org/t/cmake-job/5081
**Category:** Usage
**Tags:** os:windows
**Created:** [February 22, 2022, 4:03am UTC](https://discourse.cmake.org/t/cmake-job/5081 "2022-02-22T04:03:17Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![alice](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alice/32/1615_2.png) [@alice](https://discourse.cmake.org/u/alice)
#### Post date: [February 22, 2022, 4:03am UTC](https://discourse.cmake.org/t/cmake-job/5081/1 "2022-02-22T04:03:17Z")

</div>

cmake --help  
I cant find --job information.

Here is the command and I want to speed up the build and install.  
How can I add some parameter for the command to speed up?

```auto
cmake -B build/ -D CMAKE_BUILD_TYPE=Release
cmake --build build/ --config Release
cmake --install build/ --config Release --prefix C:/release/

```

---

<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 22, 2022, 11:45am UTC](https://discourse.cmake.org/t/cmake-job/5081/2 "2022-02-22T11:45:27Z")

</div>

There is the `--parallel` (or `-j`) flag you can use with `--build` or `--install`.

---

<div class="post-metadata">

### Author: ![McMartin](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mcmartin/32/150_2.png) [@McMartin](https://discourse.cmake.org/u/McMartin)
#### Post date: [February 22, 2022, 11:53am UTC](https://discourse.cmake.org/t/cmake-job/5081/3 "2022-02-22T11:53:21Z")

</div>

The documentation is here: [https://cmake.org/cmake/help/latest/manual/cmake.1.html#build-a-project](https://cmake.org/cmake/help/latest/manual/cmake.1.html#build-a-project)

---

<div class="post-metadata">

### Author: ![alice](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alice/32/1615_2.png) [@alice](https://discourse.cmake.org/u/alice)
#### Post date: [February 23, 2022, 2:43am UTC](https://discourse.cmake.org/t/cmake-job/5081/4 "2022-02-23T02:43:16Z")

</div>

> [@ben.boeckel](#):
>
> you can use with `--build` or `--install`.

Can I use both of them (build and install) ?

```auto
cmake -B build/ -D CMAKE_BUILD_TYPE=Release
cmake --build build/ --config Release -j12
cmake --install build/ --config Release --prefix C:/release/ -j12

```

---

<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 23, 2022, 3:32pm UTC](https://discourse.cmake.org/t/cmake-job/5081/5 "2022-02-23T15:32:41Z")

</div>

Yes, that is fine.

---

<div class="post-metadata">

### Author: ![alice](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alice/32/1615_2.png) [@alice](https://discourse.cmake.org/u/alice)
#### Post date: [February 24, 2022, 4:37am UTC](https://discourse.cmake.org/t/cmake-job/5081/6 "2022-02-24T04:37:00Z")

</div>

Does the cmake automatically detect job number and use it without command `-j` ?

For example,  
My PC has 4 job. The command will automatically build with 4 job. So I don’t need to use `-j 4`

```auto
cmake -B build/ -D CMAKE_BUILD_TYPE=Release
cmake --build build/ --config Release
cmake --install build/ --config Release --prefix C:/release/

```

cmake --help

```auto
Build in parallel using the given number of jobs.
                   If <jobs> is omitted the native build tool's
                   default number is used.
                   The CMAKE_BUILD_PARALLEL_LEVEL environment variable
                   specifies a default parallel level when this option
                   is not given

```

---

<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 24, 2022, 3:28pm UTC](https://discourse.cmake.org/t/cmake-job/5081/7 "2022-02-24T15:28:40Z")

</div>

> [@alice](#):
>
> Does the cmake automatically detect job number and use it without command `-j` ?

No. It does the default of the generator. For Ninja generators, this is to be parallel (I think `ncores + 2` is the heuristic). VS has some weird internal logic, but the rest are not parallel without it being explicit.
