Skip to content

Commit

Permalink
Merge pull request #109 from kaalkuul/master
Browse files Browse the repository at this point in the history
Add support for CMake source dependency on GLFW
  • Loading branch information
aap authored Dec 14, 2022
2 parents 0bc9c77 + 1059d79 commit 25e7350
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions cmake/librw-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ if(LIBRW_PLATFORM_GL3)
endif()

if(LIBRW_GL3_GFXLIB STREQUAL "GLFW")
find_package(glfw3 REQUIRED)
if (NOT TARGET glfw)
find_package(glfw3 REQUIRED)
endif()
elseif(LIBRW_GL3_GFXLIB STREQUAL "SDL2")
find_package(SDL2 REQUIRED)
if (NOT TARGET SDL2::SDL2)
find_package(SDL2 REQUIRED)
endif()
endif()
endif()
8 changes: 6 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,17 @@ set_target_properties(librw

if(LIBRW_PLATFORM_GL3)
if (LIBRW_GL3_GFXLIB STREQUAL "GLFW")
find_package(glfw3 REQUIRED)
if (NOT TARGET glfw)
find_package(glfw3 REQUIRED)
endif()
target_link_libraries(librw
PUBLIC
glfw
)
elseif (LIBRW_GL3_GFXLIB STREQUAL "SDL2")
find_package(SDL2 REQUIRED)
if (NOT TARGET SDL2::SDL2)
find_package(SDL2 REQUIRED)
endif()
target_compile_definitions(librw PUBLIC LIBRW_SDL2)
target_link_libraries(librw
PUBLIC
Expand Down

0 comments on commit 25e7350

Please sign in to comment.