Link SDL2

This commit is contained in:
Alexander Batalov 2022-05-19 12:41:33 +03:00
parent 55661742a2
commit b8a0d0d413
2 changed files with 26 additions and 0 deletions

View File

@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.13)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
project(fallout2-ce LANGUAGES C)
add_executable(fallout2-ce WIN32
@ -237,3 +239,4 @@ target_link_libraries(fallout2-ce
add_subdirectory("third_party/fpattern")
add_subdirectory("third_party/zlib")
add_subdirectory("third_party/sdl2")

23
third_party/sdl2/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,23 @@
# Build static lib only
set(BUILD_SHARED_LIBS OFF)
set(SDL_SHARED OFF)
set(SDL_STATIC ON)
# Fixes _ftol2_sse already defined
set(SDL_LIBC ON)
include(FetchContent)
FetchContent_Declare(sdl2
GIT_REPOSITORY "https://github.com/libsdl-org/SDL"
GIT_TAG "release-2.0.22"
)
FetchContent_GetProperties(sdl2)
if (NOT sdl2_POPULATED)
FetchContent_Populate(sdl2)
endif()
add_subdirectory(${sdl2_SOURCE_DIR} ${sdl2_BINARY_DIR} EXCLUDE_FROM_ALL)
target_include_directories(fallout2-ce PUBLIC ${sdl2_SOURCE_DIR} ${sdl2_BINARY_DIR})
target_link_libraries(fallout2-ce SDL2-static)