Catch exceptions from backend start calls
[openal-soft.git] / cmake / FindPulseAudio.cmake
blob1f6f843a1d8d5402504d06d07cd67f1cecfc5b2d
1 # - Find PulseAudio includes and libraries
3 #   PULSEAUDIO_FOUND        - True if PULSEAUDIO_INCLUDE_DIR &
4 #                             PULSEAUDIO_LIBRARY are found
5 #   PULSEAUDIO_LIBRARIES    - Set when PULSEAUDIO_LIBRARY is found
6 #   PULSEAUDIO_INCLUDE_DIRS - Set when PULSEAUDIO_INCLUDE_DIR is found
8 #   PULSEAUDIO_INCLUDE_DIR - where to find pulse/pulseaudio.h, etc.
9 #   PULSEAUDIO_LIBRARY     - the pulse library
10 #   PULSEAUDIO_VERSION_STRING - the version of PulseAudio found
13 find_path(PULSEAUDIO_INCLUDE_DIR
14           NAMES pulse/pulseaudio.h
15           DOC "The PulseAudio include directory"
18 find_library(PULSEAUDIO_LIBRARY
19              NAMES pulse
20              DOC "The PulseAudio library"
23 if(PULSEAUDIO_INCLUDE_DIR AND EXISTS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h")
24     file(STRINGS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h" pulse_version_str
25          REGEX "^#define[\t ]+pa_get_headers_version\\(\\)[\t ]+\\(\".*\"\\)")
27     string(REGEX REPLACE "^.*pa_get_headers_version\\(\\)[\t ]+\\(\"([^\"]*)\"\\).*$" "\\1"
28            PULSEAUDIO_VERSION_STRING "${pulse_version_str}")
29     unset(pulse_version_str)
30 endif()
32 include(FindPackageHandleStandardArgs)
33 find_package_handle_standard_args(PulseAudio
34     REQUIRED_VARS PULSEAUDIO_LIBRARY PULSEAUDIO_INCLUDE_DIR
35     VERSION_VAR PULSEAUDIO_VERSION_STRING
38 if(PULSEAUDIO_FOUND)
39     set(PULSEAUDIO_LIBRARIES ${PULSEAUDIO_LIBRARY})
40     set(PULSEAUDIO_INCLUDE_DIRS ${PULSEAUDIO_INCLUDE_DIR})
41 endif()
43 mark_as_advanced(PULSEAUDIO_INCLUDE_DIR PULSEAUDIO_LIBRARY)