From ae4a8bdc707521e16b966729fff708e9d7bd1bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Thu, 4 Dec 2014 14:06:25 -0500 Subject: [PATCH] cmake: fix PulseAudio.cmake version detection --- cmake/FindPulse.cmake | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cmake/FindPulse.cmake b/cmake/FindPulse.cmake index 4456a5336..acfc2c161 100644 --- a/cmake/FindPulse.cmake +++ b/cmake/FindPulse.cmake @@ -11,14 +11,14 @@ find_library(PULSE_LIBRARY pulse PATHS ${PULSE_LIBRARY_DIRS}) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Pulse DEFAULT_MSG PULSE_INCLUDE_DIR PULSE_LIBRARY) if(PULSE_LIBRARY) - execute_process(COMMAND "pactl" "--version" OUTPUT_VARIABLE PULSE_VERSION_OUTPUT) - STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" PULSE_VERSION "${PULSE_VERSION_OUTPUT}") - if(NOT PULSE_VERSION) - message(FATAL_ERROR "PulseAudio is not installed") - endif() - STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" PULSE_VERSION_MAJOR "${PULSE_VERSION}") - STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" PULSE_VERSION_MINOR "${PULSE_VERSION}") - STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" PULSE_VERSION_PATCH "${PULSE_VERSION}") + file(STRINGS "${PULSE_INCLUDE_DIR}/pulse/version.h" STR1 REGEX "PA_MAJOR") + file(STRINGS "${PULSE_INCLUDE_DIR}/pulse/version.h" STR2 REGEX "PA_MINOR") + file(STRINGS "${PULSE_INCLUDE_DIR}/pulse/version.h" STR3 REGEX "PA_MICRO") + + string(REGEX MATCHALL "[0-9]+" PULSE_VERSION_MAJOR ${STR1}) + string(REGEX MATCHALL "[0-9]+" PULSE_VERSION_MINOR ${STR2}) + string(REGEX MATCHALL "[0-9]+" PULSE_VERSION_PATCH ${STR3}) + if(PULSE_VERSION_PATCH EQUAL 0) set(PULSE_VERSION "${PULSE_VERSION_MAJOR}.${PULSE_VERSION_MINOR}") else()