From 1f0860b5e27dba2d4fcf0e66b9933f5ec6d37367 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Tue, 17 Jan 2023 14:59:50 -0700 Subject: [PATCH] Make sure the DEBUG flag is defined when building in debug mode MSVC uses _DEBUG, unlike all of the other compilers, so we aren't properly enabling/disabling varying bits of code that are dependent on DEBUG being defined. --- CMakeLists.txt | 2 +- src/util.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6233508e3d..e6d3ed2d88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ if ( MSVC ) # Set always to static runtime set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd /DDEBUG") if (CMAKE_BUILD_TYPE STREQUAL "Debug") set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDebug") set(CMAKE_MSVC_RUNTIME_LIBRARY_FLAG "MTd") diff --git a/src/util.h b/src/util.h index 0b41c7cd89..3988199368 100644 --- a/src/util.h +++ b/src/util.h @@ -41,6 +41,9 @@ #include +#ifdef ASSERT +#undef ASSERT +#endif #define ASSERT(x) assert(x) #define DEBUG_MSG(...) fprintf(stderr, __VA_ARGS__) #define DEBUG_fputs fputs