I'm building a huge C++/Qt project for Android using QtCreator. I have scripts generating .pro files and I'd like to specify within the .pro file that I wish to have the build multi-threaded.
I know I can go to project options and add -j%NUMBER_OF_PROCESSORS%
option to Make:
However, as I want to have this option set to all our projects and for every developper, I'd like to have this option be set from the .pro file.
I tried:
QMAKE_CXXFLAGS += -j%NUMBER_OF_PROCESSORS%
, but this sets the option to arm-linux-androideabi-g++, whil it should be set to mingw32-make.exe$$(MAKEFLAGS) = -j%NUMBER_OF_PROCESSORS%
, no success...not sure that's the right syntax to set and environment variable from .pro file...not even sure that's doable.$$(MAKE_COMMAND) = mingw32-make -j%NUMBER_OF_PROCESSORS%
, no successDoes anyone know how to set this option from .pro file?
Actually, he best is to recommend every developer that wants to spped-up compilation to set MAKEFLAGS
environment variable. It can decide to set it to -j2
or -j4
or -j%NUMBER_OF_PROCESSORS%
(if it wants a fast compilation even if it overloads the computer).
This is then used by make and applies to every project compiled with QtCreator. The fact that the option is used is absolutely not visible in QtCreator (nor in the options page, nor in the log), however, you can see in Windows task manager that several instances of g++ are ran in parallel.