diff options
-rw-r--r-- | CMakeLists.txt | 24 | ||||
-rw-r--r-- | src/nvim/CMakeLists.txt | 2 |
2 files changed, 12 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index df29774d45..e0daea5969 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,15 +113,14 @@ else() set(HAS_OG_FLAG 0) endif() -# Set custom build flags for RelWithDebInfo. -# -DNDEBUG purposely omitted because we want assertions. +# +# Build-type: RelWithDebInfo +# if(HAS_OG_FLAG) - set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Og -g" - CACHE STRING "Flags used by the compiler during release-with-debug builds." FORCE) -elseif(NOT MSVC) - set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" - CACHE STRING "Flags used by the compiler during release-with-debug builds." FORCE) -elseif(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DNDEBUG) + set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -Og -g") +endif() +# We _want_ assertions in RelWithDebInfo build-type. +if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DNDEBUG) string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") endif() @@ -479,20 +478,19 @@ install_helper( DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) # MIN_LOG_LEVEL for log.h -if(DEFINED MIN_LOG_LEVEL) +if("${MIN_LOG_LEVEL}" MATCHES "^$") + message(STATUS "MIN_LOG_LEVEL not specified") +else() if(NOT MIN_LOG_LEVEL MATCHES "^[0-3]$") message(FATAL_ERROR "invalid MIN_LOG_LEVEL: " ${MIN_LOG_LEVEL}) endif() message(STATUS "MIN_LOG_LEVEL set to ${MIN_LOG_LEVEL}") -else() - message(STATUS "MIN_LOG_LEVEL not specified, defaulting to 1 (INFO)") endif() # Go down the tree. add_subdirectory(src/nvim) -# Read compilation flags from src/nvim, -# used in config subdirectory below. +# Read compilation flags from src/nvim, used in config subdirectory below. include(GetCompileFlags) get_compile_flags(NVIM_VERSION_CFLAGS) diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index e2f1f16635..bcbbc76cbc 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -164,7 +164,7 @@ if(NOT MSVC) endif() endif() -if(DEFINED MIN_LOG_LEVEL) +if(NOT "${MIN_LOG_LEVEL}" MATCHES "^$") add_definitions(-DMIN_LOG_LEVEL=${MIN_LOG_LEVEL}) endif() |