···11################################
22# SDL2
33################################
44-if(BUILD_SDL AND NOT EMSCRIPTEN AND NOT RPI)
44+if(PREFER_SYSTEM_LIBRARIES)
55+ find_package(SDL2)
66+ if(SDL2_FOUND)
77+ add_library(SDL2 ALIAS SDL2::SDL2)
88+ add_library(SDL2-static ALIAS SDL2::SDL2)
99+ message(STATUS "Use system library: SDL2")
1010+ else()
1111+ message(WARNING "System library SDL2 not found")
1212+ endif()
1313+endif()
1414+1515+1616+if(BUILD_SDL AND NOT EMSCRIPTEN AND NOT RPI AND NOT PREFER_SYSTEM_LIBRARIES)
517618 if(WIN32)
719 set(HAVE_LIBC TRUE)