Skip to content

Commit

Permalink
Merge pull request #13087 from fwcd/link-mpg123-sndfile
Browse files Browse the repository at this point in the history
FindSndFile: Link mpg123 in static builds
  • Loading branch information
daschuer authored Apr 21, 2024
2 parents d832120 + fdd8d8c commit 526e4de
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cmake/modules/FindSndFile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ The following cache variables may also be set:
#]=======================================================================]

include(IsStaticLibrary)

find_package(PkgConfig QUIET)
if(PkgConfig_FOUND)
pkg_check_modules(PC_SndFile QUIET sndfile)
Expand Down Expand Up @@ -94,5 +96,24 @@ if(SndFile_FOUND)
INTERFACE_COMPILE_OPTIONS "${PC_SndFile_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${SndFile_INCLUDE_DIR}"
)
is_static_library(SndFile_IS_STATIC SndFile::sndfile)
if(SndFile_IS_STATIC)
find_package(FLAC)
if(FLAC_FOUND)
set_property(TARGET SndFile::sndfile APPEND PROPERTY INTERFACE_LINK_LIBRARIES
FLAC::FLAC
)
endif()

# The mpg123 dependency was introduced in libsndfile 1.1.0
if(SndFile_VERSION VERSION_GREATER_EQUAL "1.1.0")
find_package(mpg123 CONFIG)
if(mpg123_FOUND)
set_property(TARGET SndFile::sndfile APPEND PROPERTY INTERFACE_LINK_LIBRARIES
MPG123::libmpg123
)
endif()
endif()
endif()
endif()
endif()

0 comments on commit 526e4de

Please sign in to comment.