Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FindSndFile: Link mpg123 in static builds #13087

Merged
merged 4 commits into from
Apr 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
Loading