From 9b37590ca8904cf84a86f2c8d2d5895d5ecfda30 Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Fri, 13 Feb 2015 20:47:49 -0800 Subject: [PATCH] Set HS_DEBUGGING properly on non-MSVC compilers --- Sources/Plasma/CoreLib/HeadSpin.h | 4 ++-- cmake/CompilerChecks.cmake | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Sources/Plasma/CoreLib/HeadSpin.h b/Sources/Plasma/CoreLib/HeadSpin.h index 41985112..76a98e8d 100644 --- a/Sources/Plasma/CoreLib/HeadSpin.h +++ b/Sources/Plasma/CoreLib/HeadSpin.h @@ -45,9 +45,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // Ensure these get set consistently regardless of what module includes it #include "hsCompilerSpecific.h" -#if (defined(_DEBUG) || defined(UNIX_DEBUG)) +#if defined(_DEBUG) # define HS_DEBUGGING -#endif // defined(_DEBUG) || defined(UNIX_DENUG) +#endif //====================================== // Some standard includes diff --git a/cmake/CompilerChecks.cmake b/cmake/CompilerChecks.cmake index aa85866c..973b671c 100644 --- a/cmake/CompilerChecks.cmake +++ b/cmake/CompilerChecks.cmake @@ -11,6 +11,13 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX) endif() endif() +# MSVC automatically defines -D_DEBUG when /MTd or /MDd is set, so we +# need to make sure it gets added for other compilers too +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX) + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG") +endif() + # Compile-time type size checks include(CheckTypeSize)