From 756aaaee9eff40c2d77cb11514c3bba95d6675fa Mon Sep 17 00:00:00 2001 From: Igor Rudenko Date: Mon, 22 Aug 2022 23:53:24 +0300 Subject: [PATCH] CMake polishing --- CMakeLists.txt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b284863..0a5393c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,10 +4,15 @@ project(googerteller VERSION 1.0 DESCRIPTION "Audible feedback on Google communications" LANGUAGES CXX C) +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) -set(CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard to use") -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS ON) +message("-- Looking for Portable C Audio Library") +find_library(PCAUDIO_LIB NAMES pcaudio libpcaudio) +if (NOT PCAUDIO_LIB) + message(FATAL_ERROR "Could not find PCAUDIO_LIB using the following names: pcaudio, libpcaudio") +endif() +message("-- Looking for Portable C Audio Library - found") #add_library(support STATIC ext/powerblog/h2o-pp.cc # ext/powerblog/ext/simplesocket/swrappers.cc @@ -21,10 +26,10 @@ set(CMAKE_CXX_EXTENSIONS ON) #target_link_libraries(support PUBLIC -lh2o-evloop -lssl -lcrypto Threads::Threads) add_executable(teller teller.cc ext/lpm.c) -target_link_libraries(teller -lpcaudio -lpthread) +target_link_libraries(teller PRIVATE ${PCAUDIO_LIB} Threads::Threads) add_executable(testrunner testrunner.cc ext/lpm.c ) -target_link_libraries(testrunner -lpcaudio) +target_link_libraries(testrunner PRIVATE ${PCAUDIO_LIB}) enable_testing() add_test(testname testrunner)