Fix sdl2-gfx, sdl2-image, sdl2-mixer, sdl2-net, and sdl2-ttf forcing debug lib first (SDL2d) (#5948)

Prevent SDL2 dependent libraries from always linking against debug.
This commit is contained in:
Antonio Maiorano 2019-05-01 16:36:57 -04:00 committed by Curtis J Bezault
parent 3468013fcd
commit df753fbcf5
9 changed files with 18 additions and 22 deletions

View File

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0)
project(SDL2_GFX C)
find_path(SDL_INCLUDE_DIR SDL2/SDL.h)
find_library(SDL_LIBRARY NAMES SDL2d SDL2)
find_package(SDL2 CONFIG REQUIRED)
# builtin formats
set(SDL_GFX_DEFINES WIN32)
@ -18,7 +18,7 @@ add_library(SDL2_gfx
target_compile_definitions(SDL2_gfx PRIVATE ${SDL_GFX_DEFINES})
target_include_directories(SDL2_gfx PRIVATE ${SDL_INCLUDE_DIR}/SDL2)
target_link_libraries(SDL2_gfx PRIVATE ${SDL_LIBRARY})
target_link_libraries(SDL2_gfx PRIVATE SDL2::SDL2)
install(TARGETS SDL2_gfx
RUNTIME DESTINATION bin

View File

@ -1,4 +1,4 @@
Source: sdl2-gfx
Version: 1.0.4
Version: 1.0.4-1
Build-Depends: sdl2
Description: Graphics primitives (line, circle, rectangle etc.) with AA support, rotozoomer and other drawing related support functions wrapped up in a C based add-on library for the Simple Direct Media (SDL) cross-platform API layer.

View File

@ -65,18 +65,13 @@ endforeach(FORMAT)
# SDL
find_path(SDL_INCLUDE_DIR SDL2/SDL.h)
find_library(SDL_LIBRARY_RELEASE NAMES SDL2)
find_library(SDL_LIBRARY_DEBUG NAMES SDL2d)
SET(SDL_LIBRARY
debug ${SDL_LIBRARY_DEBUG}
optimized ${SDL_LIBRARY_RELEASE}
)
find_package(SDL2 CONFIG REQUIRED)
include_directories(${SDL_INCLUDE_DIR})
include_directories(${SDL_INCLUDE_DIR}/SDL2)
include_directories(${CMAKE_SOURCE_DIR})
target_link_libraries(SDL2_image ${SDL_LIBRARY})
target_link_libraries(SDL2_image SDL2::SDL2)
# external dependencies
foreach(DEPENDENCY IN LISTS DEPENDENCIES)
@ -123,7 +118,7 @@ install(EXPORT SDL2_image
message(STATUS "Link-time dependencies:")
message(STATUS " " ${SDL_LIBRARY})
message(STATUS " " SDL2::SDL2)
foreach(DEPENDENCY ${DEPENDENCIES})
if(${DEPENDENCY}_FOUND)
message(STATUS " " ${DEPENDENCY})

View File

@ -2,9 +2,10 @@ cmake_minimum_required(VERSION 3.1)
project(SDL2_MIXER C)
find_path(SDL_INCLUDE_DIR SDL.h PATH_SUFFIXES SDL2)
find_library(SDL_LIBRARY NAMES SDL2d SDL2)
find_package(SDL2 CONFIG REQUIRED)
set(SDL_MIXER_INCLUDES ${SDL_INCLUDE_DIR})
set(SDL_MIXER_LIBRARIES ${SDL_LIBRARY})
set(SDL_MIXER_LIBRARIES SDL2::SDL2)
# builtin formats
set(SDL_MIXER_DEFINES MUSIC_WAV)

View File

@ -1,5 +1,5 @@
Source: sdl2-mixer
Version: 2.0.4-1
Version: 2.0.4-2
Description: Multi-channel audio mixer library for SDL.
Build-Depends: sdl2

View File

@ -6,7 +6,7 @@ if (MSVC)
endif()
find_path(SDL_INCLUDE_DIR SDL2/SDL.h)
find_library(SDL_LIBRARY NAMES SDL2d SDL2)
find_package(SDL2 CONFIG REQUIRED)
add_library(SDL2_net SDLnet.c SDLnetselect.c SDLnetTCP.c SDLnetUDP.c version.rc)
@ -15,7 +15,7 @@ target_compile_definitions(SDL2_net PRIVATE _WINSOCK_DEPRECATED_NO_WARNINGS)
target_include_directories(SDL2_net PRIVATE ${SDL_INCLUDE_DIR}/SDL2)
if (WIN32)
target_link_libraries(SDL2_net ${SDL_LIBRARY} ws2_32 iphlpapi)
target_link_libraries(SDL2_net SDL2::SDL2 ws2_32 iphlpapi)
endif()
install(TARGETS SDL2_net
@ -35,4 +35,4 @@ if(NOT DEFINED SDL_NET_SKIP_HEADERS)
endif()
message(STATUS "Link-time dependencies:")
message(STATUS " " ${SDL_LIBRARY})
message(STATUS " " SDL2::SDL2)

View File

@ -1,4 +1,4 @@
Source: sdl2-net
Version: 2.0.1-5
Version: 2.0.1-6
Description: Networking library for SDL
Build-Depends: sdl2

View File

@ -2,14 +2,14 @@ cmake_minimum_required(VERSION 3.0)
project(SDL2_TTF C)
find_path(SDL_INCLUDE_DIR SDL2/SDL.h)
find_library(SDL_LIBRARY NAMES SDL2d SDL2)
find_package(SDL2 CONFIG REQUIRED)
find_package(Freetype REQUIRED)
add_library(SDL2_ttf SDL_ttf.c version.rc)
set_target_properties(SDL2_ttf PROPERTIES DEFINE_SYMBOL SDL2_EXPORTS)
target_include_directories(SDL2_ttf PRIVATE ${SDL_INCLUDE_DIR}/SDL2 ${FREETYPE_INCLUDE_DIRS})
target_link_libraries(SDL2_ttf ${SDL_LIBRARY} ${FREETYPE_LIBRARIES})
target_link_libraries(SDL2_ttf SDL2::SDL2 ${FREETYPE_LIBRARIES})
install(TARGETS SDL2_ttf
EXPORT SDL2_ttf
@ -28,5 +28,5 @@ if(NOT DEFINED SDL_TTF_SKIP_HEADERS)
endif()
message(STATUS "Link-time dependencies:")
message(STATUS " " ${SDL_LIBRARY})
message(STATUS " " SDL2::SDL2)
message(STATUS " " ${FREETYPE_LIBRARIES})

View File

@ -1,4 +1,4 @@
Source: sdl2-ttf
Version: 2.0.15-1
Version: 2.0.15-2
Description: A library for rendering TrueType fonts with SDL
Build-Depends: sdl2, freetype