Enable Windows specific debug code in debug builds
diff --git a/win/CMakeLists.txt b/win/CMakeLists.txt
index 951f16a..cd6fc34 100644
--- a/win/CMakeLists.txt
+++ b/win/CMakeLists.txt
@@ -2,6 +2,10 @@
 
 configure_file(resdefs.h.in ${CMAKE_CURRENT_BINARY_DIR}/resdefs.h)
 
+IF(CMAKE_BUILD_TYPE MATCHES Debug)
+  add_definitions(-D_DEBUG)
+ENDIF()
+
 add_subdirectory(rfb_win32)
 
 if(BUILD_WINVNC)