CMake polishing

This commit is contained in:
Igor Rudenko 2022-08-22 23:53:24 +03:00
parent 806cd60569
commit 756aaaee9e

View File

@ -4,10 +4,15 @@ project(googerteller VERSION 1.0
DESCRIPTION "Audible feedback on Google communications" DESCRIPTION "Audible feedback on Google communications"
LANGUAGES CXX C) 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") message("-- Looking for Portable C Audio Library")
set(CMAKE_CXX_STANDARD_REQUIRED ON) find_library(PCAUDIO_LIB NAMES pcaudio libpcaudio)
set(CMAKE_CXX_EXTENSIONS ON) 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 #add_library(support STATIC ext/powerblog/h2o-pp.cc
# ext/powerblog/ext/simplesocket/swrappers.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) #target_link_libraries(support PUBLIC -lh2o-evloop -lssl -lcrypto Threads::Threads)
add_executable(teller teller.cc ext/lpm.c) 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 ) add_executable(testrunner testrunner.cc ext/lpm.c )
target_link_libraries(testrunner -lpcaudio) target_link_libraries(testrunner PRIVATE ${PCAUDIO_LIB})
enable_testing() enable_testing()
add_test(testname testrunner) add_test(testname testrunner)