How do I utilise all the cores for nmake?


Question

I just got a new quad core computer and noticed that nmake is only using 1 process.

I used to use make which had the switch -j4 for launching 4 processes. What is the nmake equivalent?

[edit] Based on the information below I have been able to add a command to my qmake project file:

QMAKE_CXXFLAGS += /MP

Which effectively did it for me. Many thanks.

1
43
3/2/2009 12:43:03 PM

Accepted Answer

According to MSDN, there's no such option for nmake.

You can however make the compiler build multiple files in parallel by using the /MP option with the VC++ command line compiler and passing multiple files at the same time:

> cl /MP a.cpp b.cpp c.cpp

However note that most Makefiles don't call the compiler like this - they usual invoke the compiler separate for each individual source file, which would prevent the /MP option from doing anything useful.

21
2/7/2016 10:28:42 PM

Another generic, non-Qt-related way to tell nmake to use all the cores is to set environmental variable CL to /MP:

set CL=/MP
nmake

will use all the CPU cores.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon