From b5872ea79e0c2f71c1e1ddf908b5feba3d0f68c2 Mon Sep 17 00:00:00 2001 From: GPUCode <47210458+GPUCode@users.noreply.github.com> Date: Fri, 23 Sep 2022 20:55:51 +0300 Subject: [PATCH] cmake: Add SDL2 alias when using system library --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 13e5624a66..5f40ab278e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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)