From 7165a8eb0227f03a5126496de4a2f3407a72c3a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Sun, 7 Nov 2021 15:47:41 +0100 Subject: Add ability to control PulseAudio volume I know, son, it might be hard to accept, but you're imported. Your true parents are wmstatus and paswitch, from the desktop-tools family. Also, fix unnecessary linking of optional dependencies. --- CMakeLists.txt | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index d425bb2..17c70ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,12 +46,23 @@ if (WITH_FFTW) if (NOT fftw_FOUND) message (FATAL_ERROR "FFTW not found") endif () + list (APPEND extra_libraries ${fftw_LIBRARIES}) +endif () + +pkg_check_modules (libpulse libpulse) +option (WITH_PULSE "Enable control of PulseAudio sink volume" ${libpulse_FOUND}) +if (WITH_PULSE) + if (NOT libpulse_FOUND) + message (FATAL_ERROR "libpulse not found") + endif () + list (APPEND extra_libraries ${libpulse_LIBRARIES}) endif () include_directories (${Unistring_INCLUDE_DIRS} ${Ncursesw_INCLUDE_DIRS} ${Termo_INCLUDE_DIRS} ${curl_INCLUDE_DIRS} - ${fftw_INCLUDE_DIRS}) -link_directories (${curl_LIBRARY_DIRS} ${fftw_LIBRARY_DIRS}) + ${fftw_INCLUDE_DIRS} ${libpulse_INCLUDE_DIRS}) +link_directories (${curl_LIBRARY_DIRS} + ${fftw_LIBRARY_DIRS} ${libpulse_LIBRARY_DIRS}) # Configuration if ("${CMAKE_SYSTEM_NAME}" MATCHES "BSD") @@ -82,8 +93,7 @@ include_directories (${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR}) # Build the main executable and link it add_executable (${PROJECT_NAME} ${PROJECT_NAME}.c) target_link_libraries (${PROJECT_NAME} ${Unistring_LIBRARIES} - ${Ncursesw_LIBRARIES} termo-static ${curl_LIBRARIES} - ${fftw_LIBRARIES} ${extra_libraries}) + ${Ncursesw_LIBRARIES} termo-static ${curl_LIBRARIES} ${extra_libraries}) add_threads (${PROJECT_NAME}) # Installation -- cgit v1.2.3