[llvm-commits] [llvm] r72864 - in /llvm/trunk: CMakeLists.txt docs/CMake.html

Oscar Fuentes ofv at wanadoo.es
Thu Jun 4 02:26:44 PDT 2009


Author: ofv
Date: Thu Jun  4 04:26:16 2009
New Revision: 72864

URL: http://llvm.org/viewvc/llvm-project?rev=72864&view=rev
Log:
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.

Modified:
    llvm/trunk/CMakeLists.txt
    llvm/trunk/docs/CMake.html

Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=72864&r1=72863&r2=72864&view=diff

==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Thu Jun  4 04:26:16 2009
@@ -58,13 +58,22 @@
 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" )

Modified: llvm/trunk/docs/CMake.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CMake.html?rev=72864&r1=72863&r2=72864&view=diff

==============================================================================
--- llvm/trunk/docs/CMake.html (original)
+++ llvm/trunk/docs/CMake.html Thu Jun  4 04:26:16 2009
@@ -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>





More information about the llvm-commits mailing list