Disable Visual C++ 2013 Debug mode assert on null pointer in some STL algorithms,
[oota-llvm.git] / cmake / modules / HandleLLVMOptions.cmake
index 1aadd61c6024fb24af89d50d31f5cc3a9141cda8..7a6f63319fbd2163e392c6e6c061d4b221ea18fe 100644 (file)
@@ -247,6 +247,12 @@ if( MSVC_IDE )
 endif()
 
 if( MSVC )
+  if( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0 )
+    # For MSVC 2013, disable iterator null pointer checking in debug mode,
+    # especially so std::equal(nullptr, nullptr, nullptr) will not assert.
+    add_llvm_definitions("-D_DEBUG_POINTER_IMPL=")
+  endif()
+  
   include(ChooseMSVCCRT)
 
   if( NOT (${CMAKE_VERSION} VERSION_LESS 2.8.11) )