cmake-conan
cmake-conan copied to clipboard
Build package from source (always) with -jN flag
Running a conan_cmake_run() macro with BUILD all parameter leads to building from source a required package.
I noticed that only one CPU core is used. Is there any possibility to pass the -jN flag to the macro? Or maybe there is other way to achieve it?
BTW, Why in conan_cmake_run() macro there is all option for BUILD parameter instead of always? It may lead to confusion I guess.
Hi @kontrybutor,
Tipically, Conan will try to build packages in parallel and set the -j flag to the value cpu_count() or apply the value of the environment variable CONAN_CPU_COUNT if defined. This happens if the recipes use the legacy build helpers. Please check docs about this.
For the new build helpers and generators there's a configuration value that you can set in the global.conf file called: tools.build:jobs=<value you want> this will configure the build system to build in parallel for that number of jobs if supported.
Regarding the BUILD argument, the always build policy can only be applied inside recipes. As conan.cmake is invoking Conan through the command line it needs to call to the --build argument without a value, that's why we "invented" the all argument to set the --build argument to empty value.
Hope this helps.