diff --git a/CMakeLists.txt b/CMakeLists.txt index a3326beb..d5f5f376 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,8 +22,10 @@ else() set(CMAKE_CXX_STANDARD_REQUIRED ON) endif() -# Default to release mode -set(CMAKE_BUILD_TYPE "Release") +# Determine if build mode +if(CMAKE_BUILD_TYPE MATCHES Debug) + add_compile_options(-g) +endif() # Include mingw runntime into the binary if (GCC OR MINGW) diff --git a/module/CMakeLists.txt b/module/CMakeLists.txt index b49f3b5e..e243f929 100644 --- a/module/CMakeLists.txt +++ b/module/CMakeLists.txt @@ -90,6 +90,12 @@ if(ENABLE_MYSQL) target_link_libraries(SqModule MySQL::MySQL) endif() endif() +# Determine if build mode +if(CMAKE_BUILD_TYPE MATCHES Release) + target_compile_definitions(SqModule PRIVATE NDEBUG=1) +else() + target_compile_definitions(SqModule PRIVATE _DEBUG=1 SQMOD_EXCEPTLOC=1) +endif() # Force 32-bit binaries when necessary if(FORCE_32BIT_BIN) set_target_properties(SqModule PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32") diff --git a/sqrat/CMakeLists.txt b/sqrat/CMakeLists.txt index 15e17f2e..87edc7a3 100644 --- a/sqrat/CMakeLists.txt +++ b/sqrat/CMakeLists.txt @@ -14,6 +14,12 @@ add_library(Sqrat STATIC sqrat.cpp sqrat.h sqrat/sqratTypes.h sqrat/sqratUtil.h ) +# Determine if build mode +if(CMAKE_BUILD_TYPE MATCHES Release) + target_compile_definitions(Sqrat PRIVATE NDEBUG=1) +else() + target_compile_definitions(Sqrat PRIVATE _DEBUG=1) +endif() # Set library compiler options target_compile_definitions(Sqrat PUBLIC SCRAT_USE_EXCEPTIONS=1 SCRAT_USE_CXX11_OPTIMIZATIONS=1) # Set specific compiler options diff --git a/squirrel/CMakeLists.txt b/squirrel/CMakeLists.txt index 0eba56ca..8dfcaccd 100644 --- a/squirrel/CMakeLists.txt +++ b/squirrel/CMakeLists.txt @@ -40,6 +40,12 @@ add_library(Squirrel STATIC stdlib/sqstdstring.cpp stdlib/sqstdsystem.cpp ) +# Determine if build mode +if(CMAKE_BUILD_TYPE MATCHES Release) + target_compile_definitions(Squirrel PRIVATE NDEBUG=1) +else() + target_compile_definitions(Squirrel PRIVATE _DEBUG=1) +endif() # Make sure Squirrel knows this is 64 bit if(CMAKE_SIZEOF_VOID_P EQUAL 8) target_compile_definitions(Squirrel PUBLIC _SQ64) diff --git a/vcmp/vcmp.h b/vcmp/vcmp.h index c85e6111..9a9bdf6b 100644 --- a/vcmp/vcmp.h +++ b/vcmp/vcmp.h @@ -1,4 +1,5 @@ #pragma once +//#define VCMP_SDK_2_1 // Choose which SDK to use #ifdef VCMP_SDK_2_1 #include "vcmp21.h"