From: Reid Kleckner Date: Sun, 7 Apr 2013 01:45:01 +0000 (+0000) Subject: [cmake] Avoid rel+asserts warnings when passing -UNDEBUG X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=16f19693282b41bb6b0a627e417684add6f26de4;p=oota-llvm.git [cmake] Avoid rel+asserts warnings when passing -UNDEBUG MSVC 2012 gives warning D9025, "overriding /D NDEBUG with -UNDEBUG". Removing the original definition of NDEBUG silences this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178967 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake index 4e59a3e3d90..516f2dd9ebd 100644 --- a/cmake/modules/HandleLLVMOptions.cmake +++ b/cmake/modules/HandleLLVMOptions.cmake @@ -21,6 +21,9 @@ if( LLVM_ENABLE_ASSERTIONS ) # explicitly undefine it: if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" ) add_definitions( -UNDEBUG ) + # Also remove /D NDEBUG to avoid MSVC warnings about conflicting defines. + string (REGEX REPLACE "(^| )[/-]D *NDEBUG($| )" " " + CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") endif() else() if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )