summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/portaudio/bindings/cpp/cmake/modules/FindPortAudio.cmake
blob: 5d58c158bed8e84ab6947f18eefa7e82ffad2db3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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
# )