Merge pull request #109 from kaalkuul/master

Add support for CMake source dependency on GLFW
This commit is contained in:
aap 2022-12-14 19:23:43 +01:00 committed by GitHub
commit 25e735048f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View File

@ -15,8 +15,12 @@ if(LIBRW_PLATFORM_GL3)
endif() endif()
if(LIBRW_GL3_GFXLIB STREQUAL "GLFW") if(LIBRW_GL3_GFXLIB STREQUAL "GLFW")
if (NOT TARGET glfw)
find_package(glfw3 REQUIRED) find_package(glfw3 REQUIRED)
endif()
elseif(LIBRW_GL3_GFXLIB STREQUAL "SDL2") elseif(LIBRW_GL3_GFXLIB STREQUAL "SDL2")
if (NOT TARGET SDL2::SDL2)
find_package(SDL2 REQUIRED) find_package(SDL2 REQUIRED)
endif() endif()
endif() endif()
endif()

View File

@ -150,13 +150,17 @@ set_target_properties(librw
if(LIBRW_PLATFORM_GL3) if(LIBRW_PLATFORM_GL3)
if (LIBRW_GL3_GFXLIB STREQUAL "GLFW") if (LIBRW_GL3_GFXLIB STREQUAL "GLFW")
if (NOT TARGET glfw)
find_package(glfw3 REQUIRED) find_package(glfw3 REQUIRED)
endif()
target_link_libraries(librw target_link_libraries(librw
PUBLIC PUBLIC
glfw glfw
) )
elseif (LIBRW_GL3_GFXLIB STREQUAL "SDL2") elseif (LIBRW_GL3_GFXLIB STREQUAL "SDL2")
if (NOT TARGET SDL2::SDL2)
find_package(SDL2 REQUIRED) find_package(SDL2 REQUIRED)
endif()
target_compile_definitions(librw PUBLIC LIBRW_SDL2) target_compile_definitions(librw PUBLIC LIBRW_SDL2)
target_link_libraries(librw target_link_libraries(librw
PUBLIC PUBLIC