If you don’t pass LLVM_ENABLE_ASSERTIONS at all, CMake should implicitly add
-DNDEBUG to release only. You can verify this by inspecting the CMakeCache.txt
file and looking at the CMAKE_CXX_FLAGS_* variables. In mine I see:
//Flags used by the compiler during all build types.
CMAKE_CXX_FLAGS:STRING
//Flags used by the compiler during debug builds.
CMAKE_CXX_FLAGS_DEBUG:STRING=-g
//Flags used by the compiler during release builds for minimum
// size.
CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
//Flags used by the compiler during release builds.
CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
//Flags used by the compiler during release builds with debug info.
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
-Chris
> On Sep 12, 2015, at 2:36 PM, Norilo Vesa-Petri via llvm-dev <llvm-dev at
lists.llvm.org> wrote:
>
> Dear LLVM developers,
>
> I’m building LLVM with Visual Studio on Windows. My desired configuration
is to have NDEBUG defined for a Release build and not defined for a Debug build
(within a single solution). LLVM_ENABLE_ASSERTIONS seems to define NDEBUG for
both configurations, which results in my project breaking in Release mode if
assertions were enabled or Debug mode if they were disabled.
>
> Is there another flag I should tweak? Essentially I’d like the CMake
default behavior with regard to NDEBUG in a multi-configuration solution to be
left alone.
>
> Many thanks,
> Vesa Norilo
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
<http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20150916/13f27993/attachment.html>