cmake: Add SDL2 alias when using system library

This commit is contained in:
GPUCode 2022-09-23 20:55:51 +03:00 committed by GitHub
parent cbd5d1c15c
commit b5872ea79e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -370,6 +370,10 @@ endif()
# SDL2
if (ENABLE_SDL2 AND USE_SYSTEM_SDL2)
find_package(SDL2 REQUIRED)
add_library(SDL2 INTERFACE)
target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARY}")
target_include_directories(SDL2 INTERFACE "${SDL2_INCLUDE_DIR}")
add_library(SDL2::SDL2 ALIAS SDL2)
endif()
add_subdirectory(src)