mame/3rdparty/portaudio/bindings/cpp/cmake/modules/FindPortAudio.cmake
invertego 963561c7cb
3rdparty/portaudio: Updated to latest upstream version. (#11604)
Up-to-date with revision 24c8d575e588d557d28f4011becb753421346860.  Resolves issues building with Visual Studio.

Enabled PortAudio when building with Visual Studio and clang-cl.

docs: Removed note about duplicate GUID symbols in PortAudio when built with MSVC.
2023-10-09 01:50:30 +11:00

40 lines
1.0 KiB
CMake

macro(handle_default)
endmacro()
if(TARGET PortAudio::portaudio)
# nothing to do
return()
endif()
# search for portaudio as cmake module
find_package(PortAudio CONFIG QUIET)
if(PortAudio_FOUND)
if(TARGET PortAudio::portaudio)
return()
elseif(TARGET portaudio)
# vcpkg and old portaudio installations do not provide the same targets
add_library(PortAudio::portaudio ALIAS portaudio)
return()
else()
message(FATAL_ERROR "PortAudio_FOUND but not target PortAudio::portaudio")
endif()
endif()
# search for portaudio via pkg-config
message(STATUS "portaudio could not be found via cmake, specify PortAudio_DIR.\n Searching for it via pkg-config")
find_package(PkgConfig REQUIRED)
pkg_check_modules(portaudio REQUIRED QUIET IMPORTED_TARGET GLOBAL portaudio-2.0)
add_library(PortAudio::portaudio ALIAS PkgConfig::portaudio)
return()
# include(FindPackageHandleStandardArgs)
# find_package_handle_standard_args(Foo
# FOUND_VAR Foo_FOUND
# REQUIRED_VARS
# Foo_LIBRARY
# Foo_INCLUDE_DIR
# VERSION_VAR Foo_VERSION
# )