Commit 89fe32ddf91bec36d1469dbd030e7d9e2e0f883d

Sam Lantinga 2020-04-05T08:46:59

Fixed bug 5072 - Test resources missing when building with SDL_TEST and CMake DominikD There are several tests that need resources in the output directory to work: * `testiconv` depends on `utf8.txt` * `testoverlay2` and `teststreaming` depend on `moose.dat` This patch adds these two files to the `RESOURCE_FILES` variable. One could also copy `shapes\*.bmp` over to the output directory for `testshape` to use but this patch doesn't do that for three reasons: * executable takes path as an argument and doesn't need these files side by side * these are ~45MB and copying them over would cause build directory to swell * there are already files in the output directory that can be used with this test (`sample.bmp` and `button.bmp`)

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index a380bc8..8798005 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -94,7 +94,7 @@ add_executable(testoffscreen testoffscreen.c)
 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/resources_dummy.c "int main(int argc, const char **argv){ return 1; }\n")
 add_executable(SDL2_test_resoureces ${CMAKE_CURRENT_BINARY_DIR}/resources_dummy.c)
 
-file(GLOB RESOURCE_FILES *.bmp *.wav)
+file(GLOB RESOURCE_FILES *.bmp *.wav moose.dat utf8.txt)
 foreach(RESOURCE_FILE ${RESOURCE_FILES})
     add_custom_command(TARGET SDL2_test_resoureces POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${RESOURCE_FILE} $<TARGET_FILE_DIR:SDL2_test_resoureces>)
 endforeach(RESOURCE_FILE)