[CMake] cmake --build parallel options (was: VS2012 builds using v3.1.0 are a lot slower than v2.8.12)

Brad King brad.king at kitware.com
Wed Jan 21 11:12:09 EST 2015


On 01/21/2015 11:00 AM, Hendrik Sattler wrote:
> This makes cmake --build much less predictable across cmake versions and cmake projects.
> How can I find out if msbuild is chosen without inspecting the cmake project?

One can't, but that is a fault of VS and/or Intel Fortran for having cases
that require devenv or msbuild, not a fault of CMake for trying to deal
with it.  Since 3.0 we always picks msbuild unless Fortran is involved.
This is fairly predictable moving forward.

> - get the CMAKE_VS_MSBUILD... from cache and at set CMAKE_MAKE_PROGRAM from it.
> 
> @Paul: You can probably modify the CMAKE_VS_MSBUILD... variable to add /m.

The CMAKE_VS_MSBUILD_COMMAND variable:

 http://www.cmake.org/cmake/help/v3.1/variable/CMAKE_VS_MSBUILD_COMMAND.html

is not cached.  It is available to CMakeLists.txt code.

> But to compile in parallel should be s decision of the user, not the
> project, and thus a decision of the caller of cmake --build.

Rather than requiring users to run

 cmake --build . -- $tool_specific_parallel_option

to get a parallel build we could instead extend the "cmake --build"
command to support an option mapping to the right parallel option
underneath:

 cmake --build . --parallel
 cmake --build . --parallel=$n

-Brad



More information about the CMake mailing list