[CMake] Parallel builds

J Decker d3ck0r at gmail.com
Wed Sep 16 13:30:10 EDT 2015


On Wed, Sep 16, 2015 at 9:17 AM, Greg Marr <greg.marr at autodesk.com> wrote:
> 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.
>
/mp has no effect on cmake projects since each file is compiled with a
separate command... it relies more on msbuild /m:<num> option...

from https://msdn.microsoft.com/en-us/library/bb385193.aspx?f=255&MSPPError=-2147217396

cl /MP7 a.cpp b.cpp c.cpp d.cpp e.cpp

but cl is invoked for each source already; multiple sources aren't passed to cl.



> --
>
> 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:
> http://public.kitware.com/mailman/listinfo/cmake


More information about the CMake mailing list