summaryrefslogtreecommitdiff
path: root/CMake/Modules/FindPortaudio.cmake
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2021-09-09 22:49:13 +0200
committerChristoph Berg <myon@debian.org>2021-09-09 22:49:13 +0200
commit7aa182cc9860464e41cc8b1ed7ea2419f70deb91 (patch)
treeae7d07f023c64e3faca0b852d67209a205ab2998 /CMake/Modules/FindPortaudio.cmake
parent23a6b427e4bf791af53d91784c993b67f47e4635 (diff)
parent85895feeaf88bcde26bbfc71e8f6b2047c0f5f41 (diff)
Update upstream source from tag 'upstream/2.5.0_rc6+repack'
Update to upstream version '2.5.0~rc6+repack' with Debian dir b9d3381eb71d484f93fd73a092484a5814baf716
Diffstat (limited to 'CMake/Modules/FindPortaudio.cmake')
-rw-r--r--CMake/Modules/FindPortaudio.cmake50
1 files changed, 50 insertions, 0 deletions
diff --git a/CMake/Modules/FindPortaudio.cmake b/CMake/Modules/FindPortaudio.cmake
new file mode 100644
index 00000000..4a38cc44
--- /dev/null
+++ b/CMake/Modules/FindPortaudio.cmake
@@ -0,0 +1,50 @@
+# - Try to find portaudio
+#
+# Once done, this will define:
+#
+# Portaudio_FOUND - system has portaudio
+# Portaudio_VERSION - The version of the portaudio library which was found
+#
+# and the following imported targets::
+#
+# Portaudio::Portaudio - The portaudio library
+#
+
+include (LibFindMacros)
+
+libfind_pkg_detect (Portaudio portaudio-2.0
+ FIND_PATH portaudio.h
+ FIND_LIBRARY portaudio
+ )
+
+libfind_process (Portaudio)
+
+# fix up extra link libraries for macOS as target_link_libraries gets
+# it wrong for frameworks
+unset (_next_is_framework)
+unset (_Portaudio_EXTRA_LIBS)
+foreach (_lib IN LISTS Portaudio_PKGCONF_LDFLAGS)
+ if (_next_is_framework)
+ list (APPEND _Portaudio_EXTRA_LIBS "-framework ${_lib}")
+ unset (_next_is_framework)
+ elseif (${_lib} STREQUAL "-framework")
+ set (_next_is_framework TRUE)
+ else ()
+ list (APPEND _Portaudio_EXTRA_LIBS ${_lib})
+ endif ()
+endforeach ()
+
+if (Portaudio_FOUND AND NOT TARGET Portaudio::Portaudio)
+ add_library (Portaudio::Portaudio UNKNOWN IMPORTED)
+ set_target_properties (Portaudio::Portaudio PROPERTIES
+ IMPORTED_LOCATION "${Portaudio_LIBRARY}"
+ INTERFACE_COMPILE_OPTIONS "${Portaudio_PKGCONF_CFLAGS_OTHER}"
+ INTERFACE_INCLUDE_DIRECTORIES "${Portaudio_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES "${_Portaudio_EXTRA_LIBS}"
+ )
+endif ()
+
+mark_as_advanced (
+ Portaudio_INCLUDE_DIR
+ Portaudio_LIBRARY
+ )