Skip to content

Commit

Permalink
Switch to cmake scripts provided by SDL2_{mixer,image,ttf} libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
AMDmi3 committed Mar 17, 2023
1 parent 77dac76 commit 8242985
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 56 deletions.
15 changes: 4 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,23 @@ endif()

if(SDL2PP_WITH_IMAGE)
find_package(SDL2_image REQUIRED)
set(SDL2_ALL_LIBRARIES ${SDL2_ALL_LIBRARIES} SDL2::SDL2_image)
set(SDL2_ALL_LIBRARIES ${SDL2_ALL_LIBRARIES} SDL2_image::SDL2_image)
set(SDL2_ALL_PKGCONFIG_MODULES "${SDL2_ALL_PKGCONFIG_MODULES} SDL2_image")
else()
message(STATUS "SDL2_image support disabled")
endif()

if(SDL2PP_WITH_TTF)
find_package(SDL2_ttf REQUIRED)
set(SDL2_ALL_LIBRARIES ${SDL2_ALL_LIBRARIES} SDL2::SDL2_ttf)
set(SDL2_ALL_LIBRARIES ${SDL2_ALL_LIBRARIES} SDL2_ttf::SDL2_ttf)
set(SDL2_ALL_PKGCONFIG_MODULES "${SDL2_ALL_PKGCONFIG_MODULES} SDL2_ttf")
else()
message(STATUS "SDL2_ttf support disabled")
endif()

if(SDL2PP_WITH_MIXER)
find_package(SDL2_mixer REQUIRED)
set(SDL2_ALL_LIBRARIES ${SDL2_ALL_LIBRARIES} SDL2::SDL2_mixer)
set(SDL2_ALL_LIBRARIES ${SDL2_ALL_LIBRARIES} SDL2_mixer::SDL2_mixer)
set(SDL2_ALL_PKGCONFIG_MODULES "${SDL2_ALL_PKGCONFIG_MODULES} SDL2_mixer")
else()
message(STATUS "SDL2_mixer support disabled")
Expand Down Expand Up @@ -243,12 +243,5 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
NAMESPACE SDL2pp::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/SDL2pp
)
install(
FILES
${PROJECT_BINARY_DIR}/cmake/SDL2ppConfig.cmake
cmake/FindSDL2_image.cmake
cmake/FindSDL2_ttf.cmake
cmake/FindSDL2_mixer.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/SDL2pp
)
install(FILES ${PROJECT_BINARY_DIR}/cmake/SDL2ppConfig.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/SDL2pp)
endif()
14 changes: 0 additions & 14 deletions cmake/FindSDL2_image.cmake

This file was deleted.

14 changes: 0 additions & 14 deletions cmake/FindSDL2_mixer.cmake

This file was deleted.

14 changes: 0 additions & 14 deletions cmake/FindSDL2_ttf.cmake

This file was deleted.

6 changes: 3 additions & 3 deletions cmake/SDL2ppConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
find_package(SDL2 REQUIRED)

if(@SDL2PP_WITH_IMAGE@)
include("${CMAKE_CURRENT_LIST_DIR}/FindSDL2_image.cmake")
find_package(SDL2_image REQUIRED)
endif()

if(@SDL2PP_WITH_TTF@)
include("${CMAKE_CURRENT_LIST_DIR}/FindSDL2_ttf.cmake")
find_package(SDL2_ttf REQUIRED)
endif()

if(@SDL2PP_WITH_MIXER@)
include("${CMAKE_CURRENT_LIST_DIR}/FindSDL2_mixer.cmake")
find_package(SDL2_mixer REQUIRED)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/SDL2ppTargets.cmake")

0 comments on commit 8242985

Please sign in to comment.