2020-11-02 20:30:13 +00:00
|
|
|
# - Find PulseAudio includes and libraries
|
|
|
|
#
|
|
|
|
# PULSEAUDIO_FOUND - True if PULSEAUDIO_INCLUDE_DIR &
|
|
|
|
# PULSEAUDIO_LIBRARY are found
|
2021-04-17 20:30:03 +00:00
|
|
|
# PulseAudio::PulseAudio - Imported target for PulseAudio, if found
|
2020-11-02 20:30:13 +00:00
|
|
|
# PULSEAUDIO_LIBRARIES - Set when PULSEAUDIO_LIBRARY is found
|
|
|
|
# PULSEAUDIO_INCLUDE_DIRS - Set when PULSEAUDIO_INCLUDE_DIR is found
|
|
|
|
#
|
|
|
|
# PULSEAUDIO_INCLUDE_DIR - where to find pulse/pulseaudio.h, etc.
|
|
|
|
# PULSEAUDIO_LIBRARY - the pulse library
|
|
|
|
# PULSEAUDIO_VERSION_STRING - the version of PulseAudio found
|
|
|
|
#
|
|
|
|
|
|
|
|
find_path(PULSEAUDIO_INCLUDE_DIR
|
|
|
|
NAMES pulse/pulseaudio.h
|
|
|
|
DOC "The PulseAudio include directory"
|
|
|
|
)
|
|
|
|
|
|
|
|
find_library(PULSEAUDIO_LIBRARY
|
|
|
|
NAMES pulse
|
|
|
|
DOC "The PulseAudio library"
|
|
|
|
)
|
|
|
|
|
|
|
|
if(PULSEAUDIO_INCLUDE_DIR AND EXISTS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h")
|
2021-07-04 05:24:21 +00:00
|
|
|
file(STRINGS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h" pulse_version_str
|
|
|
|
REGEX "^#define[\t ]+pa_get_headers_version\\(\\)[\t ]+\\(\".*\"\\)")
|
2020-11-02 20:30:13 +00:00
|
|
|
|
2021-07-04 05:24:21 +00:00
|
|
|
string(REGEX REPLACE "^.*pa_get_headers_version\\(\\)[\t ]+\\(\"([^\"]*)\"\\).*$" "\\1"
|
|
|
|
PULSEAUDIO_VERSION_STRING "${pulse_version_str}")
|
|
|
|
unset(pulse_version_str)
|
2020-11-02 20:30:13 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(PulseAudio
|
2021-07-04 05:24:21 +00:00
|
|
|
REQUIRED_VARS PULSEAUDIO_LIBRARY PULSEAUDIO_INCLUDE_DIR
|
|
|
|
VERSION_VAR PULSEAUDIO_VERSION_STRING
|
2020-11-02 20:30:13 +00:00
|
|
|
)
|
|
|
|
|
2021-04-17 20:30:03 +00:00
|
|
|
if(PULSEAUDIO_LIBRARY AND NOT TARGET PulseAudio::PulseAudio)
|
|
|
|
add_library(PulseAudio::PulseAudio UNKNOWN IMPORTED GLOBAL)
|
|
|
|
set_target_properties(PulseAudio::PulseAudio PROPERTIES
|
|
|
|
IMPORTED_LOCATION "${PULSEAUDIO_LIBRARY}"
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${PULSEAUDIO_INCLUDE_DIR}")
|
|
|
|
endif()
|
|
|
|
|
2020-11-02 20:30:13 +00:00
|
|
|
if(PULSEAUDIO_FOUND)
|
2021-07-04 05:24:21 +00:00
|
|
|
set(PULSEAUDIO_LIBRARIES ${PULSEAUDIO_LIBRARY})
|
|
|
|
set(PULSEAUDIO_INCLUDE_DIRS ${PULSEAUDIO_INCLUDE_DIR})
|
2020-11-02 20:30:13 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
mark_as_advanced(PULSEAUDIO_INCLUDE_DIR PULSEAUDIO_LIBRARY)
|