I don’t know anything about QTCreator, but the question really boils down to 
how to get your IDE to pass extra args to the build tool - it’s not really a 
cmake issue except to the extent that CMake can be used to invoke the build 
step (after it has been used to generate the build).  It sounds like QT uses 
“cmake --build” to do the build phase (which makes sense), so you just need to 
add your “-j N” argument to the build step invocation. If you believe this:  
https://doc.qt.io/qtcreator/creator-build-settings.html, then it sounds like 
maybe “Tool Arguments” is what you want (see “CMake Build Steps”) ?  BTW, the 
way I do this myself (since I don’t use an IDE) is something like “cmake 
--build . -- -j 8”  where the double dash stops shell argument processing and 
effectively passes everything else on to the build tool that cmake ultimately 
invokes (e.g. make or ninja or msbuild, etc.)

HTH,
Mike

> On Feb 16, 2018, at 8:31 AM, Cornelis Bockemühl <corne...@bockemuehl.ch> 
> wrote:
> 
> Hello,
> 
> Somehow I seem to miss some crucial point regarding setup for parallel build 
> with CMake, so I would be happy if somebody can push me the last few 
> millimeters to hit my target!
> 
> My configuration is on OpenSuse Linux (Leap - 64-bit), working with QtCreator 
> and CMake, using the "make" configuration.
> 
> I learned from "the internet" that actually I would have to pass a -jN option 
> to make or gmake (with N being the max number of processors I want to use). 
> Or even more elegant: go for a -lN option to somehow balance the load. Sounds 
> good!
> 
> But what I do not see is how to pass these nice options to make through CMake 
> and QtCreator! One attempt was to specify CMAKE_CXX_FLAGS=-j4 or the like 
> because some comment "in the internet" seemed to suggest this. However, like 
> I already feared: this passes the option to the compiler call - and that is 
> the wrong address for it, so I get an error message.
> 
> Basically I think that it is 99% a CMake question and maximum 1% a QtCreator 
> problem, so I am asking this question here.
> 
> And now I am stuck - if not some friendly and knowing person can help me out 
> of this!
> 
> Thanks for any helpful hint!
> Cornelis
> -- 
> 
> Powered by www.kitware.com
> 
> Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Kitware offers various services to support the CMake community. For more 
> information on each offering, please visit:
> 
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
> 
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
> 
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

Reply via email to