From 371f78c70cfa10b65c6aaad1604977f9349f8eb9 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sun, 12 Nov 2023 20:42:45 +0000 Subject: [PATCH] FindVorbis: Link ogg in static builds --- cmake/modules/FindVorbis.cmake | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cmake/modules/FindVorbis.cmake b/cmake/modules/FindVorbis.cmake index c622989303ac..0baf0a1ba1dd 100644 --- a/cmake/modules/FindVorbis.cmake +++ b/cmake/modules/FindVorbis.cmake @@ -43,6 +43,8 @@ The following cache variables may also be set: #]=======================================================================] +include(IsStaticLibrary) + find_path(Vorbis_vorbis_INCLUDE_DIR NAMES vorbis/codec.h DOC "Vorbis include directory" @@ -96,6 +98,18 @@ foreach(component ${Vorbis_FIND_COMPONENTS}) endif() endforeach() +if(Vorbis_vorbis_FOUND) + is_static_library(Vorbis_vorbis_IS_STATIC Vorbis::vorbis) + if(Vorbis_vorbis_IS_STATIC) + find_package(Ogg) + if(Ogg_FOUND) + set_property(TARGET Vorbis::vorbis APPEND PROPERTY INTERFACE_LINK_LIBRARIES + Ogg::ogg + ) + endif() + endif() +endif() + include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Vorbis REQUIRED_VARS Vorbis_vorbis_INCLUDE_DIR Vorbis_vorbis_LIBRARY