From 8f727ab315ce81415bac0491cabf7ad1014cd285 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Dec 2025 11:16:52 +0000 Subject: [PATCH] Change SDL version selection to support SDL3, SDL2, and sdl Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com> --- CMakeLists.txt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ce7e3b9..80014fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,8 @@ if(ENABLE_CLANG_TIDY) endif() endif() option(BUILD_SDL3_APP "Build the SDL3 Vulkan demo" ON) -option(USE_SDL3 "Use SDL3 instead of SDL2 for both the demo and tests" ON) +set(SDL_VERSION "SDL3" CACHE STRING "SDL version to use: SDL3, SDL2, or sdl") +set_property(CACHE SDL_VERSION PROPERTY STRINGS "SDL3" "SDL2" "sdl") set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -75,12 +76,17 @@ if(BUILD_SDL3_APP) endif() # SDL is required for both the demo app and cube_script_tests (used by audio_player) -if(USE_SDL3) +if(SDL_VERSION STREQUAL "SDL3") find_package(SDL3 CONFIG REQUIRED) set(SDL_TARGET SDL3::SDL3) -else() +elseif(SDL_VERSION STREQUAL "SDL2") find_package(SDL2 CONFIG REQUIRED) set(SDL_TARGET SDL2::SDL2) +elseif(SDL_VERSION STREQUAL "sdl") + find_package(SDL CONFIG REQUIRED) + set(SDL_TARGET SDL::SDL) +else() + message(FATAL_ERROR "Invalid SDL_VERSION: ${SDL_VERSION}. Must be SDL3, SDL2, or sdl") endif() find_package(lua CONFIG REQUIRED)