[CMake] Parallel builds

Petr Bena benapetr at gmail.com
Wed Sep 16 12:07:44 EDT 2015


This seems to be the precise answer to my question! Thank you

On Wed, Sep 16, 2015 at 5:55 PM, Cory Quammen <cory.quammen at kitware.com> wrote:
> Hi Petr,
>
> 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
> 127 IF(MSVC_VERSION GREATER 1400)
> 128   SET(CMAKE_CXX_MP_FLAG OFF CACHE BOOL "Build with /MP flag enabled")
> 129   SET(PROCESSOR_COUNT "$ENV{NUMBER_OF_PROCESSORS}")
> 130   SET(CMAKE_CXX_MP_NUM_PROCESSORS CACHE ${PROCESSOR_COUNT} "The maximum
> number of processes for the /MP flag")
> 131   IF (CMAKE_CXX_MP_FLAG)
> 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}")
> 134   ENDIF ()
> 135 ENDIF()
>
> Hope that helps,
> Cory
>
> On Wed, Sep 16, 2015 at 11:44 AM, Petr Bena <benapetr at gmail.com> wrote:
>>
>> I know that I can pass -j parameter to GNU make as well as there is
>> some sort of option to run MSVC compiler by hand and give that similar
>> parameter, but that's not exactly what I want.
>>
>> I would prefer a way to get cmake to generate solution files for MSVC
>> in a way that these options are enabled by default. Right now I need
>> to do this by hand and when I run cmake again, it overwrites the
>> solution files I modified and restore back the settings that disallow
>> the multithreaded builds. Basically I would like to know if there is
>> some option I would add to CMakeLists.txt that would make it do so. I
>> understand that this may not possible with current version of CMake
>> though.
>>
>> Thanks
>>
>> On Wed, Sep 16, 2015 at 5:28 PM, Bill Hoffman <bill.hoffman at kitware.com>
>> wrote:
>> > http://www.kitware.com/blog/home/post/434
>> >
>> > -Bill
>> >
>> >
>> > --
>> >
>> > 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
>> --
>>
>> 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
>
>
>
>
> --
> Cory Quammen
> R&D Engineer
> Kitware, Inc.


More information about the CMake mailing list