mirror of
https://github.com/NoelFB/blah.git
synced 2024-11-25 16:18:57 +08:00
Use system SDL2 if can be found
This commit is contained in:
parent
2e533e2a31
commit
502f57ad3d
|
@ -92,20 +92,26 @@ if (SDL2_ENABLED)
|
||||||
if (EMSCRIPTEN)
|
if (EMSCRIPTEN)
|
||||||
set_target_properties(blah PROPERTIES COMPILE_FLAGS "-s USE_SDL=2")
|
set_target_properties(blah PROPERTIES COMPILE_FLAGS "-s USE_SDL=2")
|
||||||
else()
|
else()
|
||||||
# TODO: Maybe select system SDL2 and then fallback to downloading if it doesn't exist
|
# Attempt to find SDL2
|
||||||
include(FetchContent)
|
find_package(SDL2 QUIET)
|
||||||
FetchContent_Declare(
|
|
||||||
SDL2
|
# If CMake cannot find SDL2 library, then it gets downloaded and compiled that way
|
||||||
GIT_REPOSITORY https://github.com/SDL-mirror/SDL
|
if (NOT ${SDL2_FOUND})
|
||||||
GIT_TAG release-2.0.14 # grab latest release
|
include(FetchContent)
|
||||||
)
|
FetchContent_Declare(
|
||||||
FetchContent_GetProperties(SDL2)
|
SDL2
|
||||||
if (NOT sdl2_POPULATED)
|
GIT_REPOSITORY https://github.com/SDL-mirror/SDL
|
||||||
FetchContent_Populate(SDL2)
|
GIT_TAG release-2.0.14 # grab latest stable release
|
||||||
add_subdirectory(${sdl2_SOURCE_DIR} ${sdl2_BINARY_DIR})
|
)
|
||||||
|
FetchContent_GetProperties(SDL2)
|
||||||
|
if (NOT sdl2_POPULATED)
|
||||||
|
FetchContent_Populate(SDL2)
|
||||||
|
add_subdirectory(${sdl2_SOURCE_DIR} ${sdl2_BINARY_DIR})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(LIBS ${LIBS} SDL2) # link to SDL2 static library
|
# Either way we are linking to SDL2
|
||||||
|
set(LIBS ${LIBS} SDL2)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user