test: Run selected noninteractive tests at build-time

In Autotools, these are run by `make -C ${builddir}/test check`.
In CMake, they're run by `make -C ${builddir} test` or
`ninja -C ${builddir} test` or `ctest --test-dir ${builddir}`.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie
2022-04-12 13:33:58 +01:00
committed by Sam Lantinga
parent b299f74d05
commit 7d2808e30b
3 changed files with 90 additions and 0 deletions

View File

@@ -2980,6 +2980,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSDL_BUILD_MICRO_VERSION=${SDL_MICRO_VERSIO
##### Tests #####
if(SDL_TEST)
include(CTest)
include_directories(BEFORE "${SDL2_BINARY_DIR}/include")
include_directories(AFTER "${SDL2_SOURCE_DIR}/include")
file(GLOB TEST_SOURCES ${SDL2_SOURCE_DIR}/src/test/*.c)