diff --git a/cmake/librw-config.cmake.in b/cmake/librw-config.cmake.in index 3c3d9e1..6cb7a8b 100644 --- a/cmake/librw-config.cmake.in +++ b/cmake/librw-config.cmake.in @@ -20,7 +20,10 @@ if(LIBRW_PLATFORM_GL3) endif() elseif(LIBRW_GL3_GFXLIB STREQUAL "SDL2") if (NOT TARGET SDL2::SDL2) - find_package(SDL2 REQUIRED) + find_package(SDL2 CONFIG) + if (NOT TARGET SDL2::SDL2) + find_package(SDL2 MODULE REQUIRED) + endif() endif() endif() endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0e3d637..21c00ac 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -159,7 +159,10 @@ if(LIBRW_PLATFORM_GL3) ) elseif (LIBRW_GL3_GFXLIB STREQUAL "SDL2") if (NOT TARGET SDL2::SDL2) - find_package(SDL2 REQUIRED) + find_package(SDL2 CONFIG) + if (NOT TARGET SDL2::SDL2) + find_package(SDL2 MODULE REQUIRED) + endif() endif() target_compile_definitions(librw PUBLIC LIBRW_SDL2) target_link_libraries(librw