SDL: cmake: Remove SDL2_test_resources dummy hack

From 618b0d414ffd5681b620346913545e41445a7f9d Mon Sep 17 00:00:00 2001
From: Cameron Gutman <[EMAIL REDACTED]>
Date: Sat, 30 Oct 2021 12:05:11 -0500
Subject: [PATCH] cmake: Remove SDL2_test_resources dummy hack

It doesn't work properly on MSVC because the dummy target fails to link
---
 test/CMakeLists.txt | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 629ac5a3b4..aae1ddc5b7 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -105,21 +105,8 @@ target_link_libraries(testshader OpenGL::GL)
 target_link_libraries(testgl2 OpenGL::GL)
 endif()
 
-# HACK: Dummy target to cause the resource files to be copied to the build directory.
-# Need to make it an executable so we can use the TARGET_FILE_DIR generator expression.
-# This is needed so they get copied to the correct Debug/Release subdirectory in Xcode.
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/resources_dummy.c "int main(int argc, const char **argv){ return 1; }\n")
-add_executable(SDL2_test_resources ${CMAKE_CURRENT_BINARY_DIR}/resources_dummy.c)
-
 file(GLOB RESOURCE_FILES *.bmp *.wav *.hex moose.dat utf8.txt)
-foreach(RESOURCE_FILE ${RESOURCE_FILES})
-    add_custom_command(TARGET SDL2_test_resources POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${RESOURCE_FILE} $<TARGET_FILE_DIR:SDL2_test_resources>)
-endforeach(RESOURCE_FILE)
-
 file(COPY ${RESOURCE_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-
-# TODO: Might be easier to make all targets depend on the resources...?
-
 set(NEEDS_RESOURCES
     testscale
     testrendercopyex
@@ -141,7 +128,9 @@ set(NEEDS_RESOURCES
     testmultiaudio
 )
 foreach(APP IN LISTS NEEDS_RESOURCES)
-    add_dependencies(${APP} SDL2_test_resources)
+    foreach(RESOURCE_FILE ${RESOURCE_FILES})
+        add_custom_command(TARGET ${APP} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${RESOURCE_FILE} $<TARGET_FILE_DIR:${APP}>)
+    endforeach(RESOURCE_FILE)
     if(APPLE)
         # Make sure resource files get installed into macOS/iOS .app bundles.  
         target_sources(${APP} PRIVATE "${RESOURCE_FILES}")