diff --git a/Tests/ConfigSources/CMakeLists.txt b/Tests/ConfigSources/CMakeLists.txt
index a3d98f685faeaa07d331f15e63287b99253d68c2..f83759ca10a909ae99fc953a051e31988776f5e3 100644
--- a/Tests/ConfigSources/CMakeLists.txt
+++ b/Tests/ConfigSources/CMakeLists.txt
@@ -74,10 +74,10 @@ add_custom_command(APPEND
   VERBATIM
   )
 foreach(n RANGE 1 5)
-  set_property(SOURCE custom${n}_Debug.cpp PROPERTY COMPILE_DEFINITIONS CUSTOM_CFG_DEBUG)
-  foreach(other Release RelWithDebInfo MinSizeRel)
+  foreach(other ${CMAKE_BUILD_TYPE} Release RelWithDebInfo MinSizeRel)
     set_property(SOURCE custom${n}_${other}.cpp PROPERTY COMPILE_DEFINITIONS CUSTOM_CFG_OTHER)
   endforeach()
+  set_property(SOURCE custom${n}_Debug.cpp PROPERTY COMPILE_DEFINITIONS CUSTOM_CFG_DEBUG)
 endforeach()
 add_library(Custom STATIC
   custom1_$<CONFIG>.cpp