Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Be-ing committed Sep 7, 2021
2 parents 169cd3e + cf0a029 commit 0fef878
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2335,7 +2335,7 @@ endif()

# SoundTouch
find_package(SoundTouch)
default_option(SoundTouch_STATIC "Link libSoundTouch statically" "NOT SoundTouch_FOUND")
default_option(SoundTouch_STATIC "Link libSoundTouch statically" "NOT SoundTouch_FOUND OR SoundTouch_VERSION VERSION_LESS 2.1.2")
if(SoundTouch_STATIC)
message(STATUS "Preparing internal libSoundTouch")
add_library(SoundTouch STATIC EXCLUDE_FROM_ALL
Expand Down
18 changes: 14 additions & 4 deletions cmake/modules/FindSoundTouch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The following cache variables may also be set:

find_package(PkgConfig QUIET)
if(PkgConfig_FOUND)
pkg_check_modules(PC_SoundTouch QUIET SoundTouch>=2.1.1)
pkg_check_modules(PC_SoundTouch QUIET soundtouch)
endif()

find_path(SoundTouch_INCLUDE_DIR
Expand All @@ -61,12 +61,22 @@ find_library(SoundTouch_LIBRARY
)
mark_as_advanced(SoundTouch_LIBRARY)

# Version detection
if(DEFINED PC_SoundTouch_VERSION)
set(SoundTouch_VERSION "${PC_SoundTouch_VERSION}")
else()
if(EXISTS "${SoundTouch_INCLUDE_DIR}/soundtouch/SoundTouch.h")
file(READ "${SoundTouch_INCLUDE_DIR}/soundtouch/SoundTouch.h" SoundTouch_H_CONTENTS)
string(REGEX MATCH "#define SOUNDTOUCH_VERSION[ \t]+\"([0-9]+\.[0-9]+\.[0-9]+)\"" _dummy "${SoundTouch_H_CONTENTS}")
set(SoundTouch_VERSION "${CMAKE_MATCH_1}")
endif()
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
SoundTouch
DEFAULT_MSG
SoundTouch_LIBRARY
SoundTouch_INCLUDE_DIR
REQUIRED_VARS SoundTouch_LIBRARY SoundTouch_INCLUDE_DIR
VERSION_VAR SoundTouch_VERSION
)

if(SoundTouch_FOUND)
Expand Down

0 comments on commit 0fef878

Please sign in to comment.