commit 868b4223cdef709d44d63091fa3fa973c99ec8c5
Author: Adam Moss <adam@broadcom.com>
Date:   Thu Nov 15 10:40:53 2012 +0000

    /Zm1000 considered harmful in VS2012 (this is probably true of >=VS2005)
    Only use it on MSVC versions older than in VS2011.
    This was making each compiler instance reserve around 750MB immediately, which in a parallel build would make some or all of the spawned compilers crash depending on system memory pressure.
    See: http://msdn.microsoft.com/en-us/library/bdscwf1c.aspx

diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index 1f28c50..7bd57eb 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -233,7 +233,13 @@ macro(__windows_compiler_msvc lang)
   set(CMAKE_${lang}_LINK_EXECUTABLE
     "${_CMAKE_VS_LINK_EXE}<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> /Fd<TARGET_PDB> <OBJECTS> /link /implib:<TARGET_IMPLIB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
 
-  set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3 /Zm1000${_FLAGS_${lang}}")
+  set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3")
+  # /Zm1000 considered harmful in VS2012 (this is probably true of >=VS2005)
+  if("${CMAKE_${lang}_COMPILER_VERSION}" VERSION_LESS 17)
+    set(CMAKE_${lang}_FLAGS_INIT "${CMAKE_${lang}_FLAGS_INIT} /Zm1000")
+  endif()
+  set(CMAKE_${lang}_FLAGS_INIT "${CMAKE_${lang}_FLAGS_INIT}${_FLAGS_${lang}}")
+
   set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}")
   set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG")
   set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
