diff --git a/CMakeLists.txt b/CMakeLists.txt index 6af569b25a0..ba63484d8c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,8 @@ This process created the file `CMakeCache.txt' and the directory `CMakeFiles'. Please delete them.") endif() +string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE) + include(FindPerl) set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}) @@ -55,6 +57,16 @@ 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) +else() + option(LLVM_ENABLE_ASSERTS "Enable asserts" ON) +endif() + +if( LLVM_ENABLE_ASSERTS ) + add_definitions( -D_DEBUG -UNDEBUG ) +endif() + if( LLVM_TARGETS_TO_BUILD STREQUAL "all" ) set( LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS} ) endif() diff --git a/docs/CMake.html b/docs/CMake.html index 27ec88ec947..b329ca46d62 100644 --- a/docs/CMake.html +++ b/docs/CMake.html @@ -248,6 +248,10 @@
gold, ar and nm all support plugins now, so everything should be + in place for an easy to use LTO build of autotooled projects:
++export CC="$PREFIX/bin/llvm-gcc -use-gold-plugin" +export CXX="$PREFIX/bin/llvm-g++ -use-gold-plugin" +export AR="$PREFIX/bin/ar --plugin libLLVMgold.so" +export NM="$PREFIX/bin/nm --plugin libLLVMgold.so" +export RANLIB=/bin/true #ranlib is not needed, and doesn't support .bc files in .a +export CFLAGS="-O4" ++
The environment variable settings may work for non-autotooled projects + too, but you may need to set the LD environment variable as well.
+