using FetchContent to control lib

This commit is contained in:
2025-12-07 15:51:19 +08:00
parent 77adfc55d4
commit b4551b462b
5 changed files with 61 additions and 23 deletions

27
cmake/SDL.cmake Normal file
View File

@@ -0,0 +1,27 @@
include(FetchContent)
# ===========================
# SDL3
# ===========================
FetchContent_Declare(
SDL3
GIT_REPOSITORY https://github.com/libsdl-org/SDL.git
GIT_TAG release-3.2.4
)
FetchContent_MakeAvailable(SDL3)
# ===========================
# SDL3_ttf使用内置 FreeType + Harfbuzz
# ===========================
set(SDLTTF_VENDORED ON CACHE BOOL "" FORCE)
set(SDLTTF_HARFBUZZ OFF CACHE BOOL "" FORCE)
set(SDLTTF_PLUTOSVG OFF CACHE BOOL "" FORCE)
FetchContent_Declare(
SDL3_ttf
GIT_REPOSITORY https://github.com/libsdl-org/SDL_ttf.git
GIT_TAG release-3.2.2 # ← 正确的版本
)
FetchContent_MakeAvailable(SDL3_ttf)