diff --git a/CMakeLists.txt b/CMakeLists.txt
index 49a68a4d86c5797337a543a4169145006c3cbdec..a0d70035e0e150ec33dc4806bd02632debbf0a42 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -91,6 +91,9 @@ $<$<CXX_COMPILER_ID:GNU>:${STRICT_ALIASING_FLAGS}>)
 target_compile_options(${module_name} PRIVATE
 $<$<CXX_COMPILER_ID:MSVC>:
 /W4 /wd4477 /DWIN32 /D_WINDOWS /GR /EHsc /MP /Zc:__cplusplus /Zc:preprocessor /permissive- ${SANITIZE_MSVC_FLAGS}>)
+if (DOSANITIZE STREQUAL "ON")
+    target_compile_options(${module_name} PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/MDd>)
+endif()
 # TODO FIXME: I'm not sure it's a good idea to propagate this option but, at this point, it was the only way that worked to silence C4477
 target_compile_options(${module_name} PUBLIC $<$<CXX_COMPILER_ID:MSVC>: /wd4477>)
 
diff --git a/unit_tests/CMakeLists.txt b/unit_tests/CMakeLists.txt
index f2c446701a45736b10b62d015be442c7ed46a615..806f62d47dcad02614a18d0d7f6e51042b164cc8 100644
--- a/unit_tests/CMakeLists.txt
+++ b/unit_tests/CMakeLists.txt
@@ -44,6 +44,9 @@ $<$<CXX_COMPILER_ID:GNU>:${STRICT_ALIASING_FLAGS}>)
 target_compile_options(${module_name} PRIVATE
 $<$<CXX_COMPILER_ID:MSVC>:
 /W4 /DWIN32 /D_WINDOWS /GR /EHsc /MP /Zc:__cplusplus /Zc:preprocessor /permissive- ${SANITIZE_MSVC_FLAGS}>)
+if (DOSANITIZE STREQUAL "ON")
+  target_compile_options(${module_name} PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/MDd>)
+endif()
 # TODO FIXME: I'm not sure it's a good idea to propagate this option but, at this point, it was the only way that worked to silence C4477
 target_compile_options(${module_name} PUBLIC $<$<CXX_COMPILER_ID:MSVC>: /wd4477>)