cmake-conan icon indicating copy to clipboard operation
cmake-conan copied to clipboard

Parallel building on Windows using clang-cl

Open Cheaterman opened this issue 3 years ago • 3 comments
trafficstars

Hi everyone!

I hope this isn't too much of a dumb question, but it seems like cmake-multi generator doesn't do parallel building on Windows using clang-cl (not msbuild).

Is that correct? Are there plans to support this?

Thanks in advance!

EDIT: Would it perhaps make sense to use both ninja and cmake_multi? Ninja for building, cmake_multi for including the result in our project?

Cheaterman avatar Jan 24 '22 20:01 Cheaterman

Hi @Cheaterman, Setting a parallel building is not responsability of the Conan generator. That's something you set when invoking the build with CMake like cmake --build -- -j4 to pass that flag to the native tool in this case, or you can also use the --parallel argument. There's an argument parallel in Conan CMake build helpers to add that argument when cmake is invoked for building through that build helper. Hope this helps

czoido avatar Jan 25 '22 09:01 czoido

Hi @czoido,

Thanks a lot for your timely and detailed answer! I might be wrong but I believe we might have had a bit of a misunderstanding: indeed, I am asking about conan-built dependencies to our project, that are being built during the configure step. Unless I am mistaken, your instructions apply to the build step and not the configure step, correct? Is there a way to make parallel builds work on Windows (with clang-cl) during the configure step? It is worth noting that it works properly on Linux.

Cheaterman avatar Jan 25 '22 18:01 Cheaterman

Hi @Cheaterman, So you mean that during CMake's configure step, that will run conan by using conan.cmake you want the dependencies to build in parallel? If the required packages use the Conan CMake build helper the parallel argument is True by default (that's probably why for Linux is building in parallel). For Windows I think /m flags are passed for Visual Studio generator. If you want to try using Ninja as CMake generator you could adjust the CONAN_CMAKE_GENERATOR environment variable.

czoido avatar Jan 27 '22 14:01 czoido