From 9456b3687f546cc9ea70c87332faaf50194214ec Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Thu, 5 Sep 2019 18:16:57 +0000 Subject: [PATCH] build: simplify -ldl handling --- CMakeLists.txt | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b32a53a..ec59316 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -155,10 +155,7 @@ if(USE_PULSE) target_sources(cubeb PRIVATE src/cubeb_pulse.c) target_compile_definitions(cubeb PRIVATE USE_PULSE) - target_link_libraries(cubeb PRIVATE pulse pthread) - if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - target_link_libraries(cubeb PRIVATE dl) - endif() + target_link_libraries(cubeb PRIVATE pulse pthread ${CMAKE_DL_LIBS}) endif() check_include_files(alsa/asoundlib.h USE_ALSA) @@ -166,10 +163,7 @@ if(USE_ALSA) target_sources(cubeb PRIVATE src/cubeb_alsa.c) target_compile_definitions(cubeb PRIVATE USE_ALSA) - target_link_libraries(cubeb PRIVATE asound pthread) - if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - target_link_libraries(cubeb PRIVATE dl) - endif() + target_link_libraries(cubeb PRIVATE asound pthread ${CMAKE_DL_LIBS}) endif() check_include_files(jack/jack.h USE_JACK) @@ -177,10 +171,7 @@ if(USE_JACK) target_sources(cubeb PRIVATE src/cubeb_jack.cpp) target_compile_definitions(cubeb PRIVATE USE_JACK) - target_link_libraries(cubeb PRIVATE jack pthread) - if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - target_link_libraries(cubeb PRIVATE dl) - endif() + target_link_libraries(cubeb PRIVATE jack pthread ${CMAKE_DL_LIBS}) endif() check_include_files(audioclient.h USE_WASAPI)