2021-04-10 07:25:28 -04:00
|
|
|
# - Try to find portaudio
|
|
|
|
#
|
|
|
|
# Once done, this will define:
|
|
|
|
#
|
2021-04-14 16:49:23 -04:00
|
|
|
# Portaudio_FOUND - system has portaudio
|
|
|
|
# Portaudio_VERSION - The version of the portaudio library which was found
|
2021-04-11 10:29:15 -04:00
|
|
|
#
|
|
|
|
# and the following imported targets::
|
|
|
|
#
|
2021-04-14 16:49:23 -04:00
|
|
|
# Portaudio::Portaudio - The portaudio library
|
2021-04-10 07:25:28 -04:00
|
|
|
#
|
2021-04-11 10:29:15 -04:00
|
|
|
|
2021-04-10 07:25:28 -04:00
|
|
|
include (LibFindMacros)
|
|
|
|
|
2021-04-14 16:49:23 -04:00
|
|
|
libfind_pkg_detect (Portaudio portaudio-2.0
|
2021-04-12 17:33:46 -04:00
|
|
|
FIND_PATH portaudio.h
|
|
|
|
FIND_LIBRARY portaudio
|
|
|
|
)
|
2021-04-10 07:25:28 -04:00
|
|
|
|
2021-04-14 16:49:23 -04:00
|
|
|
libfind_process (Portaudio)
|
|
|
|
|
|
|
|
# fix up extra link libraries for macOS as target_link_libraries gets
|
|
|
|
# it wrong for frameworks
|
|
|
|
unset (_next_is_framework)
|
2021-04-14 16:59:00 -04:00
|
|
|
unset (_Portaudio_EXTRA_LIBS)
|
|
|
|
foreach (_lib IN LISTS Portaudio_PKGCONF_LDFLAGS)
|
2021-04-14 16:49:23 -04:00
|
|
|
if (_next_is_framework)
|
2021-04-14 16:59:00 -04:00
|
|
|
list (APPEND _Portaudio_EXTRA_LIBS "-framework ${_lib}")
|
2021-04-14 16:49:23 -04:00
|
|
|
unset (_next_is_framework)
|
|
|
|
elseif (${_lib} STREQUAL "-framework")
|
|
|
|
set (_next_is_framework TRUE)
|
|
|
|
else ()
|
2021-04-14 16:59:00 -04:00
|
|
|
list (APPEND _Portaudio_EXTRA_LIBS ${_lib})
|
2021-04-14 16:49:23 -04:00
|
|
|
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}"
|
2021-04-14 16:59:00 -04:00
|
|
|
INTERFACE_LINK_LIBRARIES "${_Portaudio_EXTRA_LIBS}"
|
2021-04-11 10:29:15 -04:00
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
mark_as_advanced (
|
2021-04-14 16:49:23 -04:00
|
|
|
Portaudio_INCLUDE_DIR
|
|
|
|
Portaudio_LIBRARY
|
2021-04-11 10:29:15 -04:00
|
|
|
)
|