Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -388,16 +388,18 @@ 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) + option(LLVM_FORCE_ENABLE_DUMP "Enable dump functions in release builds" OFF) else() option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON) + option(LLVM_FORCE_ENABLE_DUMP "Enable dump functions in release builds" ON) + set(LLVM_ENABLE_DEBUG ON) endif() -if( LLVM_ENABLE_ASSERTIONS ) +if( LLVM_ENABLE_ASSERTIONS OR LLVM_FORCE_ENABLE_DUMP ) set(LLVM_ENABLE_DUMP ON) + set(LLVM_ENABLE_DEBUG ON) endif() option(LLVM_ENABLE_EXPENSIVE_CHECKS "Enable expensive checks" OFF) Index: include/llvm/Config/llvm-config.h.cmake =================================================================== --- include/llvm/Config/llvm-config.h.cmake +++ include/llvm/Config/llvm-config.h.cmake @@ -14,6 +14,9 @@ #ifndef LLVM_CONFIG_H #define LLVM_CONFIG_H +/* Define if CMAKE_BUILD_TYPE is Debug and/or NDEBUG is undefined */ +#cmakedefine LLVM_ENABLE_DEBUG + /* Define if we link Polly to the tools */ #cmakedefine LINK_POLLY_INTO_TOOLS