Tests/RunCMake/BuildDepends: Enable more depfile cases with Ninja
diff --git a/Tests/RunCMake/BuildDepends/CompileDepends.cmake b/Tests/RunCMake/BuildDepends/CompileDepends.cmake
index 2a6e9a8..f0d661b 100644
--- a/Tests/RunCMake/BuildDepends/CompileDepends.cmake
+++ b/Tests/RunCMake/BuildDepends/CompileDepends.cmake
@@ -12,7 +12,7 @@
   \"$<TARGET_FILE:main>\"
   )
 
-if (check_step EQUAL 2)
+if (RunCMake_GENERATOR MATCHES \"Make\" AND check_step EQUAL 2)
   include(\"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Makefile.cmake\")
   if (NOT CMAKE_DEPEND_INFO_FILES)
     set(RunCMake_TEST_FAILED \"Variable CMAKE_DEPEND_INFO_FILES not found.\")
@@ -46,4 +46,16 @@
     endforeach()
   endif()
 endif()
+
+if (RunCMake_GENERATOR STREQUAL \"Ninja\" AND check_step EQUAL 2)
+  execute_process(
+    COMMAND \${RunCMake_MAKE_PROGRAM} -t deps
+    WORKING_DIRECTORY \${RunCMake_TEST_BINARY_DIR}
+    OUTPUT_VARIABLE deps
+  )
+  if(NOT deps MATCHES \"CompileDepends.c\" OR NOT deps MATCHES \"CompileDepends.h\")
+    string(REPLACE deps \"\\n\" \"\\n  \" \"  \${deps}\")
+    set(RunCMake_TEST_FAILED \"Dependencies not detected correctly:\\n\${deps}\")
+  endif()
+endif()
 ")
diff --git a/Tests/RunCMake/BuildDepends/CustomCommandDepends.cmake b/Tests/RunCMake/BuildDepends/CustomCommandDepends.cmake
index 28bbf11..50ff882 100644
--- a/Tests/RunCMake/BuildDepends/CustomCommandDepends.cmake
+++ b/Tests/RunCMake/BuildDepends/CustomCommandDepends.cmake
@@ -20,7 +20,7 @@
   \"$<TARGET_FILE:main>\"
   )
 
-if (check_step EQUAL 2)
+if (RunCMake_GENERATOR MATCHES \"Make\" AND check_step EQUAL 2)
   include(\"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Makefile.cmake\")
   if (NOT CMAKE_DEPEND_INFO_FILES)
     set(RunCMake_TEST_FAILED \"Variable CMAKE_DEPEND_INFO_FILES not found.\")
@@ -70,4 +70,16 @@
     endforeach()
   endif()
 endif()
+
+if (RunCMake_GENERATOR STREQUAL \"Ninja\" AND check_step EQUAL 2)
+  execute_process(
+    COMMAND \${RunCMake_MAKE_PROGRAM} -t deps
+    WORKING_DIRECTORY \${RunCMake_TEST_BINARY_DIR}
+    OUTPUT_VARIABLE deps
+  )
+  if(NOT deps MATCHES \"main.c:.*main.c.in\")
+    string(REPLACE deps \"\\n\" \"\\n  \" \"  \${deps}\")
+    set(RunCMake_TEST_FAILED \"Dependencies not detected correctly:\\n\${deps}\")
+  endif()
+endif()
 ")
diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
index bc9d57f..addb2d5 100644
--- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
+++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
@@ -170,7 +170,9 @@
         OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang"))
     OR (RunCMake_GENERATOR STREQUAL "NMake Makefiles"
       AND MSVC_VERSION GREATER 1300
-      AND CMAKE_C_COMPILER_ID STREQUAL "MSVC"))
+      AND CMAKE_C_COMPILER_ID STREQUAL "MSVC")
+    OR RunCMake_GENERATOR MATCHES "Ninja"
+    )
   run_BuildDepends(CompileDepends)
   run_BuildDepends(CustomCommandDepends)
 endif()