cmake: give priority to SDL2 config

This commit is contained in:
Anonymous Maarten 2024-08-16 17:58:43 +02:00
parent d53e325b72
commit 0155539316
2 changed files with 8 additions and 2 deletions

View File

@ -20,7 +20,10 @@ if(LIBRW_PLATFORM_GL3)
endif() endif()
elseif(LIBRW_GL3_GFXLIB STREQUAL "SDL2") elseif(LIBRW_GL3_GFXLIB STREQUAL "SDL2")
if (NOT TARGET SDL2::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() endif()
endif() endif()

View File

@ -159,7 +159,10 @@ if(LIBRW_PLATFORM_GL3)
) )
elseif (LIBRW_GL3_GFXLIB STREQUAL "SDL2") elseif (LIBRW_GL3_GFXLIB STREQUAL "SDL2")
if (NOT TARGET SDL2::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()
target_compile_definitions(librw PUBLIC LIBRW_SDL2) target_compile_definitions(librw PUBLIC LIBRW_SDL2)
target_link_libraries(librw target_link_libraries(librw