add cmake options to perfer system libs to sdl and sdl_image
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousDelivery / windows (push) Has been cancelled
ContinuousDelivery / windows-asan (push) Has been cancelled
ContinuousDelivery / dumpsyms (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled
ContinuousIntegration / linux (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled

This commit is contained in:
Green Sky
2025-04-06 16:49:50 +02:00
parent 9b40c417a2
commit de75a067a3
3 changed files with 57 additions and 24 deletions

View File

@ -2,10 +2,26 @@ cmake_minimum_required(VERSION 3.16...3.24 FATAL_ERROR)
include(FetchContent)
option(TOMATO_DEP_SDL_USE_SYSTEM "Prefer system provided SDL" OFF)
if (TOMATO_DEP_SDL_USE_SYSTEM)
if (NOT TARGET SDL3::SDL3)
#find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3-shared)
find_package(SDL3 REQUIRED CONFIG GLOBAL QUIET)
endif()
if (TARGET SDL3::SDL3)
message(STATUS "found system SDL3")
else()
message(STATUS "system SDL3 not found")
endif()
endif()
if (NOT TARGET SDL3::SDL3)
message(STATUS "using bundled SDL3")
# bundle sdl static
set(SDL_SHARED OFF CACHE INTERNAL "")
set(SDL_STATIC ON CACHE INTERNAL "")
#TODO: pic ?
set(SDL_DISABLE_ANDROID_JAR OFF CACHE INTERNAL "")
FetchContent_Declare(SDL3