Conan: [cmake helper] CONAN_CPU_COUNT is not respected with the ninja generator

Created on 20 Sep 2019  路  2Comments  路  Source: conan-io/conan

Conan Version: 1.18.4

I just upgraded some of our projects to build with ninja by setting CONAN_CMAKE_GENERATOR=Ninja. While everything still works, this change caused quite a high load on the CI runner that I was not really expecting.

In particular, it seems like the cmake helper is ignoring the configured CONAN_CPU_COUNT value when the ninja generator is used. See:

https://github.com/conan-io/conan/blob/0882a2a8c85b848b277aa45893576a45e208e27e/conans/client/build/cmake.py#L238

I would expect that also the ninja generator adheres to the specified cpu count.

low Build medium bug

All 2 comments

Hi @niosHD ,
Maybe you could add custom arguments for the CMake build using something like this in the conanfile.py:
def build(self): cmake = CMake(self) cmake.configure() cmake.build(args=["--", "-j1"])
To reduce number of maximum commands you want Ninja to run in parallel.
Please tell us if this helps :)

Hi @niosHD

Yes, this makes sense, the Ninja generator is not receiving any parallel argument, only Makefiles and Visual. This should be added, thanks for pointing this out.

Was this page helpful?
0 / 5 - 0 ratings