[CMake] Parallel builds

Greg Marr greg.marr at autodesk.com
Wed Sep 16 12:17:39 EDT 2015


On Wed, Sep 16, 2015 at 5:55 PM, Cory Quammen <cory.quammen at kitware.com> wrote:
> VTK exposes the /MP compiler flag in its CMake configuration.
>
> Here is the relevant code from
> http://www.vtk.org/gitweb?p=VTK.git;a=blob;f=CMake/vtkDetermineCompilerFlags.cmake;h=1398050afb34ff8c0a74137d847c19a6f63b12e9;hb=HEAD
>
> 126 # Enable /MP flag for Visual Studio 2008 and greator
> 132     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP${CMAKE_CXX_MP_NUM_PROCESSORS}")
> 133     SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP${CMAKE_CXX_MP_NUM_PROCESSORS}")

If you're just going to set it to the number of processors on the machine, you might as well just use /MP, which means use the number of processors on the machine.  The only time you need a number is when you want to use a different number of parallel processes, such as only using half your capacity because something else is using the other half, or leaving one or two cores open for GUI work.



More information about the CMake mailing list