Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -385,16 +385,24 @@ option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON) option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF) -option(LLVM_ENABLE_DUMP "Enable dump functions in release builds" OFF) - -if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" ) - option(LLVM_ENABLE_ASSERTIONS "Enable assertions" OFF) -else() - option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON) +if( NOT DEFINED LLVM_ENABLE_ASSERTIONS) + if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" ) + set(LLVM_ENABLE_ASSERTIONS OFF) + else() + set(LLVM_ENABLE_ASSERTIONS ON) + endif() endif() -if( LLVM_ENABLE_ASSERTIONS ) - set(LLVM_ENABLE_DUMP ON) +if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" ) + string(REGEX REPLACE " *-DLLVM_ENABLE_DUMP *" " " + CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE} + "${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}}" ) + if (LLVM_ENABLE_ASSERTIONS OR LLVM_ENABLE_DUMP) + set(CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE} + "${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} -DLLVM_ENABLE_DUMP") + endif() + set(CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE} + "${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}}" CACHE STRING "" FORCE) endif() option(LLVM_ENABLE_EXPENSIVE_CHECKS "Enable expensive checks" OFF) Index: include/llvm/Config/config.h.cmake =================================================================== --- include/llvm/Config/config.h.cmake +++ include/llvm/Config/config.h.cmake @@ -359,9 +359,6 @@ /* Has gcc/MSVC atomic intrinsics */ #cmakedefine01 LLVM_HAS_ATOMICS -/* Define if LLVM_ENABLE_DUMP is enabled */ -#cmakedefine LLVM_ENABLE_DUMP - /* Host triple LLVM will be executed on */ #cmakedefine LLVM_HOST_TRIPLE "${LLVM_HOST_TRIPLE}"