]> git.tdb.fi Git - ext/openal.git/blob - cmake/FindPulseAudio.cmake
Import OpenAL Soft 1.23.1 sources
[ext/openal.git] / cmake / FindPulseAudio.cmake
1 # - Find PulseAudio includes and libraries
2 #
3 #   PULSEAUDIO_FOUND        - True if PULSEAUDIO_INCLUDE_DIR &
4 #                             PULSEAUDIO_LIBRARY are found
5 #
6 #   PULSEAUDIO_INCLUDE_DIR - where to find pulse/pulseaudio.h, etc.
7 #   PULSEAUDIO_LIBRARY     - the pulse library
8 #   PULSEAUDIO_VERSION_STRING - the version of PulseAudio found
9 #
10
11 find_path(PULSEAUDIO_INCLUDE_DIR
12           NAMES pulse/pulseaudio.h
13           DOC "The PulseAudio include directory"
14 )
15
16 find_library(PULSEAUDIO_LIBRARY
17              NAMES pulse
18              DOC "The PulseAudio library"
19 )
20
21 if(PULSEAUDIO_INCLUDE_DIR AND EXISTS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h")
22     file(STRINGS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h" pulse_version_str
23          REGEX "^#define[\t ]+pa_get_headers_version\\(\\)[\t ]+\\(\".*\"\\)")
24
25     string(REGEX REPLACE "^.*pa_get_headers_version\\(\\)[\t ]+\\(\"([^\"]*)\"\\).*$" "\\1"
26            PULSEAUDIO_VERSION_STRING "${pulse_version_str}")
27     unset(pulse_version_str)
28 endif()
29
30 include(FindPackageHandleStandardArgs)
31 find_package_handle_standard_args(PulseAudio
32     REQUIRED_VARS PULSEAUDIO_LIBRARY PULSEAUDIO_INCLUDE_DIR
33     VERSION_VAR PULSEAUDIO_VERSION_STRING
34 )