CMake: Reverse logic to handle debug code

Only enabling debug code by default with Debug build type
seems overly restrictive; debug output is still conditional
on the log level.
This commit is contained in:
João Valverde 2021-06-10 00:40:52 +01:00
parent 1a702e5430
commit af2a88cd18
3 changed files with 3 additions and 3 deletions

View File

@ -432,7 +432,7 @@ set_property(DIRECTORY
"G_DISABLE_DEPRECATED"
"G_DISABLE_SINGLE_INCLUDES"
$<$<OR:$<BOOL:${DISABLE_ASSERT}>,$<CONFIG:Release>>:WS_DISABLE_ASSERT>
$<$<OR:$<BOOL:${ENABLE_DEBUG}>,$<CONFIG:Debug>>:WS_DEBUG>
$<$<OR:$<BOOL:${DISABLE_DEBUG}>,$<CONFIG:Release>>:WS_DISABLE_DEBUG>
)
if( CMAKE_C_COMPILER_ID MATCHES "MSVC")

View File

@ -44,6 +44,7 @@ endif()
option(BUILD_mmdbresolve "Build MaxMind DB resolver" ON)
option(DISABLE_WERROR "Do not treat warnings as errors" OFF)
option(DISABLE_DEBUG "Disable debug code" OFF)
option(DISABLE_ASSERT "Disable assertions" OFF)
option(DISABLE_FRAME_LARGER_THAN_WARNING "Disable warning if the size of a function frame is large" OFF)
option(EXTCAP_ANDROIDDUMP_LIBPCAP "Build androiddump using libpcap" OFF)
@ -55,7 +56,6 @@ option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan) for debugging" OF
option(ENABLE_FUZZER "Enable libFuzzer instrumentation for use with fuzzshark" OFF)
option(ENABLE_CHECKHF_CONFLICT "Enable hf conflict check for debugging (start-up may be slower)" OFF)
option(ENABLE_CCACHE "Speed up compiling and linking using ccache if possible" OFF)
option(ENABLE_DEBUG "Enable debug output" OFF)
if(CMAKE_GENERATOR STREQUAL "Ninja")
option(ENABLE_COMPILER_COLOR_DIAGNOSTICS "Always enable the compiler's color diagnostic output" ON)

View File

@ -31,7 +31,7 @@ void ws_log_full(const char *log_domain, GLogLevelFlags log_level,
* to produce output for specic domains, or G_MESSAGES_DEBUG="all" for
* all domains.
*/
#ifdef WS_DEBUG
#ifndef WS_DISABLE_DEBUG
#define ws_debug(...) ws_log_full(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, \
__FILE__, __LINE__, G_STRFUNC, \
__VA_ARGS__)