Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a number of parallel jobs for make in Cmake QtCreator project?

My project is managed by CMake and I use QtCreator as a main IDE. I want to make QtCreator run make -j number_here command when it launches a build task to speed it up, but I am unable to find a corresponding configuration in QtCreator's project settings UI. I became somewhat lost in all it's settings.

Should I modify CMakeLists.txt file somehow or is it configurable from the QtCreator's UI?

like image 241
CorellianAle Avatar asked Apr 24 '18 10:04

CorellianAle


People also ask

Does CMake build in parallel?

From the release notes: The cmake(1) Build a Project ( cmake --build ) gained --parallel [<jobs>] and -j [<jobs>] options to specify a parallel build level. They map to corresponding options of the native build tool. As mentioned by dkg, you can also set the environment variable CMAKE_BUILD_PARALLEL_LEVEL .

How do you use CMake Qtcreator?

Qt Creator uses the default CMake if it does not have enough information to choose the CMake to use. To set the selected CMake executable as the default, select Make Default. To remove the selected CMake executable from the list, select Remove. Select the Kits tab to add the CMake tool to a build and run kit.

What is the difference between Qmake and CMake?

Both are build systems, but they're not very similar at all. If your project uses Qt, you're probably best off using qmake. CMake is more generic, and fits pretty much any type of project. Both qmake and CMake generate a Makefile, which is read by make to build the project.

What is CMake and Qmake in Qt?

CMake is an alternative to qmake for automating the generation of build configurations. Setting Up Qbs. Qbs is an all-in-one build tool that generates a build graph from a high-level project description (like qmake or CMake do) and executes the commands in the low-level build graph (like make does).


1 Answers

You can configure this in Qt Creator:

  1. Go to: left panel/Projects/Build Settings.
    Note: On the left Build & Run, select the build of your targeted "Kit" if you have several.

  2. Build Steps (below CMake options), click Details.

  3. In Tools arguments: add -jnumber_here.

  4. Profit!

like image 78
Mizux Avatar answered Oct 26 '22 21:10

Mizux