tests: build tests with C90 standard

C90 mode is disabled for:
- testautomation: use of isnan/isfinite
- testlock: use of kill
- testvulkan: use of c++ style strings in vulkan.h
This commit is contained in:
Anonymous Maarten
2023-05-25 01:15:12 +02:00
committed by Anonymous Maarten
parent 5b5b67df20
commit b4291412a4
8 changed files with 25 additions and 20 deletions

View File

@@ -63,7 +63,7 @@ define_property(TARGET PROPERTY SDL_NONINTERACTIVE_ARGUMENTS BRIEF_DOCS "Argumen
define_property(TARGET PROPERTY SDL_NONINTERACTIVE_TIMEOUT BRIEF_DOCS "Timeout for noninteractive executable." FULL_DOCS "Timeout for noninteractive executable.")
macro(add_sdl_test_executable TARGET)
cmake_parse_arguments(AST "NONINTERACTIVE;NEEDS_RESOURCES;TESTUTILS" "" "NONINTERACTIVE_TIMEOUT;NONINTERACTIVE_ARGS;SOURCES" ${ARGN})
cmake_parse_arguments(AST "NONINTERACTIVE;NEEDS_RESOURCES;TESTUTILS;NO_C90" "" "NONINTERACTIVE_TIMEOUT;NONINTERACTIVE_ARGS;SOURCES" ${ARGN})
if(AST_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unknown argument(s): ${AST_UNPARSED_ARGUMENTS}")
endif()
@@ -82,6 +82,10 @@ macro(add_sdl_test_executable TARGET)
if(AST_TESTUTILS)
target_link_libraries(${TARGET} PRIVATE sdltests_utils)
endif()
if(NOT AST_NO_C90 AND NOT SDL_CMAKE_PLATFORM MATCHES "^(n3ds|ps2|psp)$")
set_property(TARGET ${TARGET} PROPERTY C_STANDARD 90)
set_property(TARGET ${TARGET} PROPERTY C_EXTENSIONS FALSE)
endif()
list(APPEND SDL_TEST_EXECUTABLES ${TARGET})
if(AST_NONINTERACTIVE)
@@ -154,7 +158,7 @@ add_sdl_test_executable(testaudioinfo SOURCES testaudioinfo.c)
add_sdl_test_executable(testaudiostreamdynamicresample SOURCES testaudiostreamdynamicresample.c)
file(GLOB TESTAUTOMATION_SOURCE_FILES testautomation*.c)
add_sdl_test_executable(testautomation NEEDS_RESOURCES SOURCES ${TESTAUTOMATION_SOURCE_FILES})
add_sdl_test_executable(testautomation NEEDS_RESOURCES NO_C90 SOURCES ${TESTAUTOMATION_SOURCE_FILES})
add_sdl_test_executable(testmultiaudio NEEDS_RESOURCES TESTUTILS SOURCES testmultiaudio.c)
add_sdl_test_executable(testaudiohotplug NEEDS_RESOURCES TESTUTILS SOURCES testaudiohotplug.c)
add_sdl_test_executable(testaudiocapture SOURCES testaudiocapture.c)
@@ -224,7 +228,7 @@ add_sdl_test_executable(testjoystick SOURCES testjoystick.c)
add_sdl_test_executable(testkeys SOURCES testkeys.c)
add_sdl_test_executable(testloadso SOURCES testloadso.c)
add_sdl_test_executable(testlocale NONINTERACTIVE SOURCES testlocale.c)
add_sdl_test_executable(testlock SOURCES testlock.c)
add_sdl_test_executable(testlock NO_C90 SOURCES testlock.c)
add_sdl_test_executable(testrwlock SOURCES testrwlock.c)
add_sdl_test_executable(testmouse SOURCES testmouse.c)
@@ -255,7 +259,7 @@ add_sdl_test_executable(testqsort NONINTERACTIVE SOURCES testqsort.c)
add_sdl_test_executable(testbounds NONINTERACTIVE SOURCES testbounds.c)
add_sdl_test_executable(testcustomcursor SOURCES testcustomcursor.c)
add_sdl_test_executable(gamepadmap NEEDS_RESOURCES TESTUTILS SOURCES gamepadmap.c)
add_sdl_test_executable(testvulkan SOURCES testvulkan.c)
add_sdl_test_executable(testvulkan NO_C90 SOURCES testvulkan.c)
add_sdl_test_executable(testoffscreen SOURCES testoffscreen.c)
add_sdl_test_executable(testpopup SOURCES testpopup.c)