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`)
This commit is contained in:
Sam Lantinga 2020-04-05 08:46:59 -07:00
parent f3e609679d
commit 89fe32ddf9
1 changed files with 1 additions and 1 deletions

View File

@ -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)