diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b0a2e85ec4..0fd0f0c456 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -30,6 +30,12 @@ if(NOT TARGET SDL3::${sdl_name_component}) find_package(SDL3 3.0.0 REQUIRED CONFIG COMPONENTS ${sdl_name_component} SDL3_test) endif() +if(TARGET sdl-build-options) + set(SDL3_TESTS_SUBPROJECT ON) +else() + set(SDL3_TESTS_SUBPROJECT OFF) +endif() + # CMake incorrectly detects opengl32.lib being present on MSVC ARM64 if(NOT MSVC OR NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64") # Prefer GLVND, if present @@ -115,6 +121,13 @@ macro(add_sdl_test_executable TARGET) if(TARGET sdl-global-options) target_link_libraries(${TARGET} PRIVATE $) endif() + + if(SDL3_TESTS_SUBPROJECT) + # FIXME: only add "${SDL3_BINARY_DIR}/include-config-$>" + include paths of external dependencies + target_include_directories(${TARGET} PRIVATE "$") + else() + target_include_directories(${TARGET} PRIVATE "../include") + endif() endmacro() check_include_file(signal.h HAVE_SIGNAL_H) @@ -149,7 +162,7 @@ add_sdl_test_executable(testdrawchessboard SOURCES testdrawchessboard.c) add_sdl_test_executable(testdropfile SOURCES testdropfile.c) add_sdl_test_executable(testerror NONINTERACTIVE SOURCES testerror.c) -if(LINUX AND TARGET sdl-build-options) +if(LINUX AND SDL3_TESTS_SUBPROJECT) set(build_options_dependent_tests ) add_sdl_test_executable(testevdev NONINTERACTIVE SOURCES testevdev.c) @@ -258,10 +271,6 @@ if(HAVE_WFORMAT_EXTRA_ARGS) target_compile_definitions(testautomation PRIVATE HAVE_WFORMAT_EXTRA_ARGS) endif() -if(NOT HAVE_X11) - target_compile_definitions(testautomation PRIVATE SDL_DISABLE_SYSWM_X11) -endif() - if(SDL_DUMMYAUDIO) set_property(TARGET testaudioinfo PROPERTY SDL_NONINTERACTIVE 1) set_property(TARGET testsurround PROPERTY SDL_NONINTERACTIVE 1) diff --git a/test/testautomation_intrinsics.c b/test/testautomation_intrinsics.c index bbc452d9fc..2add769575 100644 --- a/test/testautomation_intrinsics.c +++ b/test/testautomation_intrinsics.c @@ -1,6 +1,10 @@ /** * Intrinsics test suite */ + +/* Disable intrinsics that are unsupported by the current compiler */ +#include + #include #include #include diff --git a/test/testautomation_syswm.c b/test/testautomation_syswm.c index 74b4c49a5b..069c4b13cc 100644 --- a/test/testautomation_syswm.c +++ b/test/testautomation_syswm.c @@ -1,6 +1,10 @@ /** * SysWM test suite */ + +/* Avoid inclusion of e.g. X11 headers when these are not installed */ +#include + #include #include #include