From 11dbd625ab7829b4438c00210195548ce05898a7 Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Fri, 1 Oct 2021 16:37:42 -0700 Subject: [PATCH] cmake: add FindPortAudio script PortAudio only added a config a few weeks ago which means most package managers don't have it. I don't know if there's a way to use the config without having our own find script, but we'll see. --- CMakeLists.txt | 3 ++- cmake/FindPortAudio.cmake | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 cmake/FindPortAudio.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 2607c7bf1..b9ec14e58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,7 +122,8 @@ list(APPEND OLIVE_LIBRARIES # Link PortAudio find_package(PortAudio REQUIRED) -list(APPEND OLIVE_LIBRARIES PortAudio) +list(APPEND OLIVE_INCLUDE_DIRS ${PORTAUDIO_INCLUDE_DIRS}) +list(APPEND OLIVE_LIBRARIES ${PORTAUDIO_LIBRARIES}) # Optional: Link OpenTimelineIO find_package(OpenTimelineIO) diff --git a/cmake/FindPortAudio.cmake b/cmake/FindPortAudio.cmake new file mode 100644 index 000000000..fad2313df --- /dev/null +++ b/cmake/FindPortAudio.cmake @@ -0,0 +1,32 @@ +# - Find PortAudio includes and libraries +# +# PORTAUDIO_FOUND - True if PORTAUDIO_INCLUDE_DIR & PORTAUDIO_LIBRARY +# are found +# PORTAUDIO_LIBRARIES - Set when PORTAUDIO_LIBRARY is found +# PORTAUDIO_INCLUDE_DIRS - Set when PORTAUDIO_INCLUDE_DIR is found +# +# PORTAUDIO_INCLUDE_DIR - where to find portaudio.h, etc. +# PORTAUDIO_LIBRARY - the portaudio library +# + +find_path(PORTAUDIO_INCLUDE_DIR + NAMES portaudio.h + DOC "The PortAudio include directory" +) + +find_library(PORTAUDIO_LIBRARY + NAMES portaudio + DOC "The PortAudio library" +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(PortAudio + REQUIRED_VARS PORTAUDIO_LIBRARY PORTAUDIO_INCLUDE_DIR +) + +if(PORTAUDIO_FOUND) + set(PORTAUDIO_LIBRARIES ${PORTAUDIO_LIBRARY}) + set(PORTAUDIO_INCLUDE_DIRS ${PORTAUDIO_INCLUDE_DIR}) +endif() + +mark_as_advanced(PORTAUDIO_INCLUDE_DIR PORTAUDIO_LIBRARY)