[CMake] VS2012 builds using v3.1.0 are a lot slower than v2.8.12

Brad King brad.king at kitware.com
Wed Jan 21 09:05:32 EST 2015


On 01/20/2015 03:40 PM, Paul Smith wrote:
> Where can I go to find out more about how cmake --build chooses whether
> to use msbuild vs. devenv?

The behavior was updated in 3.0 and is now described here:

 http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_MAKE_PROGRAM.html

In 2.8.12 and below we always stored CMAKE_MAKE_PROGRAM in CMakeCache.txt
instead of waiting until build time to choose it.  This was problematic
because it was initialized before configuring the project so we could not
know whether devenv had to be chosen for Intel Fortran support or not,
so it always chose devenv if available.  However, devenv does not work
when using an alternative PlatformToolset with CMAKE_GENERATOR_TOOLSET:

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.user/46795/focus=46969

Therefore we had to switch to build-time selection of the build tool.
The change was mentioned in the 3.0 release notes:

 http://www.cmake.org/cmake/help/v3.0/release/3.0.0.html#other-changes
 "Selection of the proper msbuild or devenv tool is now performed as
  late as possible when the solution (.sln) file is available so it
  can depend on project content."

On 01/21/2015 05:53 AM, Yves Frederix wrote:
> options like  'cmake --build . --config Release -- /m'. I checked and
> this indeed works as expected.

Yes.

> The above explains all my initial observations. However, the fix is
> not very handy. As I understood, one does not know until build time
> what exact build (devenv or msbuild) will be used by CMake

MSBuild will be used for VS >= 10 unless Fortran code is involved.  You
can also add -DCMAKE_MAKE_PROGRAM=/path/to/msbuild.exe to explicitly
specify it.  Once that is in CMakeCache.txt then it will always be used
by "cmake --build".

-Brad



More information about the CMake mailing list