diff options
author | Oscar Fuentes <ofv@wanadoo.es> | 2009-06-04 09:26:16 +0000 |
---|---|---|
committer | Oscar Fuentes <ofv@wanadoo.es> | 2009-06-04 09:26:16 +0000 |
commit | 76941b273316eca4559c05ef34bfc88f13db64f1 (patch) | |
tree | 6fcb4b69d145724c7f40b5458f64bb48b1df097d | |
parent | 3b0a4f186b697b53a3a97c68c4278aea7fec848e (diff) |
CMake: Renamed LLVM_ENABLE_ASSERTS to
LLVM_ENABLE_ASSERTIONS. Fine-tuned the logic that controls the
definition of NDEBUG and _DEBUG macros.
Thanks to Jay Foad for this suggestions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72864 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | CMakeLists.txt | 17 | ||||
-rw-r--r-- | docs/CMake.html | 4 |
2 files changed, 15 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ba63484d8c..a846eaeb2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,13 +58,22 @@ endif( MSVC ) option(LLVM_ENABLE_THREADS "Use threads if available." ON) if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" ) - option(LLVM_ENABLE_ASSERTS "Enable asserts" OFF) + option(LLVM_ENABLE_ASSERTIONS "Enable assertions" OFF) else() - option(LLVM_ENABLE_ASSERTS "Enable asserts" ON) + option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON) endif() -if( LLVM_ENABLE_ASSERTS ) - add_definitions( -D_DEBUG -UNDEBUG ) +if( LLVM_ENABLE_ASSERTIONS ) + add_definitions( -D_DEBUG ) + # On Release builds cmake automatically defines NDEBUG, so we + # explicitly undefine it: + if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" ) + add_definitions( -UNDEBUG ) + endif() +else() + if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" ) + add_definitions( -DNDEBUG ) + endif() endif() if( LLVM_TARGETS_TO_BUILD STREQUAL "all" ) diff --git a/docs/CMake.html b/docs/CMake.html index b329ca46d6..ac3b57a848 100644 --- a/docs/CMake.html +++ b/docs/CMake.html @@ -248,8 +248,8 @@ <dt><b>LLVM_ENABLE_THREADS</b>:BOOL</dt> <dd>Build with threads support, if available. Defaults to ON.</dd> - <dt><b>LLVM_ENABLE_ASSERTS</b>:BOOL</dt> - <dd>Enables code asserts. Defaults to ON if and only if + <dt><b>LLVM_ENABLE_ASSERTIONS</b>:BOOL</dt> + <dd>Enables code assertions. Defaults to ON if and only if CMAKE_BUILD_TYPE is <i>Release</i>.</dd> <dt><b>LLVM_ENABLE_PIC</b>:BOOL</dt> |