How do you find documentation of -j option

AFAIK, cmake --build -j . is a legal command, but I can’t find documentation for -j option. I tried:

cmake --help | grep -- "-j"
cmake --help-command build_command | grep -- "-j"

as well as searching for -j and option -j on https://cmake.org/cmake/help/latest/search.html?q=q=option+j without success.

I think cmake --build . --help gives the usage of the “Build a Project” mode, which is also documented here: https://cmake.org/cmake/help/latest/manual/cmake.1.html#build-a-project

2 Likes

From the cmake docs (https://cmake.org/cmake/help/latest/manual/cmake.1.html)

`--parallel [<jobs>], -j [<jobs>]`

The maximum number of concurrent processes to use when building. If `<jobs>` is omitted the native build tool’s default number is used.

The [`CMAKE_BUILD_PARALLEL_LEVEL`](https://cmake.org/cmake/help/latest/envvar/CMAKE_BUILD_PARALLEL_LEVEL.html#envvar:CMAKE_BUILD_PARALLEL_LEVEL) environment variable, if set, specifies a default parallel level when this option is not given.

Some native build tools always build in parallel. The use of `<jobs>` value of `1` can be used to limit to a single job.
1 Like

Thanks. It would be nice though, if -j was discoverable through the search engine. I’m not sure if it can be configured to successfully handle queries like that.

cmake --build . --help works great. I didn’t know you can use --help option that far to the right.

It’s a victim of the short search query (single letter) and having search syntax attached to it (the hyphen). For things like this, doing a raw text search (on the repo or the raw HTML files if you have the source or docs handy) using grep or similar tools is how I usually handle it.

1 Like