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,6 +2,26 @@ cmake_minimum_required(VERSION 3.16...3.24 FATAL_ERROR)
include(FetchContent)
option(TOMATO_DEP_SDL_IMAGE_USE_SYSTEM "Prefer system provided SDL_image" OFF)
if (TOMATO_DEP_SDL_IMAGE_USE_SYSTEM)
if (NOT TARGET SDL3_image::SDL3_image)
find_package(SDL3_image REQUIRED CONFIG GLOBAL QUIET)
endif()
if (TARGET SDL3_image::SDL3_image)
message(STATUS "found system SDL3_image")
else()
message(STATUS "system SDL3_image not found")
endif()
endif()
if (SDLIMAGE_BACKEND_STB)
# mandatory security
# technically its only used if no proper libjpeg and libpng where found/configured
message(FATAL_ERROR "SDL3_image has the STBI backend enabled")
endif()
if (NOT TARGET SDL3_image::SDL3_image)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
# TODO: make pr to make this an option