CMakeLists: Make SDL2 compilation conditional

* vcpkg fails to compile SDL2 on MinGW, so better fetch the package from the environment first
This commit is contained in:
GPUCode
2022-07-20 23:58:45 +03:00
committed by GitHub
parent 8feafd2ac5
commit 2d8aded953

View File

@ -208,8 +208,12 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
if (ENABLE_SDL2) if (ENABLE_SDL2)
vcpkg_add_package(sdl2) find_package(SDL2 CONFIG)
find_package(SDL2 CONFIG REQUIRED)
if (NOT SDL2_FOUND)
vcpkg_add_package(sdl2)
find_package(SDL2 CONFIG REQUIRED)
endif()
if (SDL2_FOUND) if (SDL2_FOUND)
add_library(SDL2 INTERFACE) add_library(SDL2 INTERFACE)