Use pkg-config to get linker flags for SDL_mixer

This makes CMake use the dynamic library instead of the static library on
my system. The latter doesn't link on today's Debian unstable due to a
missing libmad.a.
heavy-resources
Günther Brammer 2014-04-19 17:22:29 +02:00
parent 69f64ea341
commit 9941388526
1 changed files with 5 additions and 4 deletions

View File

@ -876,10 +876,10 @@ if(USE_CONSOLE)
SET(HAVE_LIBREADLINE ${READLINE_FOUND} CACHE INTERNAL "libreadline available")
endif()
include(FindPkgConfig)
# Set GTK link directory. This needs to be done before add_executable,
# otherwise the path is not used for linking clonk
if(USE_GTK)
include(FindPkgConfig)
if (USE_GTK3)
pkg_check_modules(GTK3 REQUIRED "glib-2.0 >= 2.32" "gtk+-3.0 >= 3.4")
include_directories(${GTK3_INCLUDE_DIRS})
@ -892,7 +892,6 @@ if(USE_GTK)
endif()
# Try to find GTK for mape
include(FindPkgConfig)
if (PKG_CONFIG_FOUND)
if (USE_GTK3)
pkg_check_modules(MAPE_GTK glib-2.0>=2.32 gthread-2.0 gtk+-3.0>=3.4 gtksourceview-3.0)
@ -1397,8 +1396,10 @@ if(NOT HAVE_FMOD AND NOT USE_OPEN_AL OR USE_SDL_MAINLOOP AND NOT USE_OPEN_AL)
SET(HAVE_SDL ${SDL_FOUND})
if(SDL_FOUND)
include_directories(${SDL_INCLUDE_DIR})
FINDLIB(SDLMIXER_LIBRARIES SDL_mixer)
if(SDLMIXER_LIBRARIES)
pkg_check_modules(SDLMIXER "SDL_mixer")
if(SDLMIXER_FOUND)
include_directories(${SDLMIXER_INCLUDE_DIRS})
link_directories(${SDLMIXER_LIBRARY_DIRS})
SET(HAVE_LIBSDL_MIXER ON)
endif()
target_link_libraries(openclonk