SDL_mixer: cmake: don't use Ogg::Ogg

From 17b9bb4c3d4c742f15cc6b52c22c3880afa0813d Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Fri, 12 Jan 2024 18:59:47 +0100
Subject: [PATCH] cmake: don't use Ogg::Ogg

---
 CMakeLists.txt           | 4 ----
 cmake/FindOpusFile.cmake | 6 ++++--
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6930ffd5..fd33e6b1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -468,7 +468,6 @@ if(SDL3MIXER_OPUS)
         endif()
     else()
         find_package(OpusFile ${required})
-        find_package(Ogg ${required})
         if(OpusFile_FOUND AND Ogg_FOUND)
             set(SDL3MIXER_OPUS_ENABLED TRUE)
             message(STATUS "Using system opusfile")
@@ -486,9 +485,6 @@ if(SDL3MIXER_OPUS)
                 $<TARGET_PROPERTY:OpusFile::opusfile,INCLUDE_DIRECTORIES>
                 $<TARGET_PROPERTY:OpusFile::opusfile,INTERFACE_INCLUDE_DIRECTORIES>
                 $<TARGET_PROPERTY:OpusFile::opusfile,INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>
-                $<TARGET_PROPERTY:Ogg::Ogg,INCLUDE_DIRECTORIES>
-                $<TARGET_PROPERTY:Ogg::Ogg,INTERFACE_INCLUDE_DIRECTORIES>
-                $<TARGET_PROPERTY:Ogg::Ogg,INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>
             )
             target_get_dynamic_library(dynamic_opusfile OpusFile::opusfile)
             message(STATUS "Dynamic opus (opusfile): ${dynamic_opusfile}")
diff --git a/cmake/FindOpusFile.cmake b/cmake/FindOpusFile.cmake
index 4f7d9cc5..9c48d191 100644
--- a/cmake/FindOpusFile.cmake
+++ b/cmake/FindOpusFile.cmake
@@ -25,8 +25,10 @@ set(OpusFile_LINK_OPTIONS "${_opusfile_link_options}" CACHE STRING "Extra link f
 
 set(OpusFile_LINK_DIRECTORIES "${_opusfile_link_directories}" CACHE PATH "Extra link directories of opusfile")
 
+find_package(Ogg ${required})
+
 find_package_handle_standard_args(OpusFile
-    REQUIRED_VARS OpusFile_LIBRARY OpusFile_INCLUDE_PATH
+    REQUIRED_VARS OpusFile_LIBRARY OpusFile_INCLUDE_PATH Ogg_FOUND
 )
 
 if(OpusFile_FOUND)
@@ -38,7 +40,7 @@ if(OpusFile_FOUND)
         add_library(OpusFile::opusfile UNKNOWN IMPORTED)
         set_target_properties(OpusFile::opusfile PROPERTIES
             IMPORTED_LOCATION "${OpusFile_LIBRARY}"
-            INTERFACE_INCLUDE_DIRECTORIES "${OpusFile_dirs};$<TARGET_PROPERTY>"
+            INTERFACE_INCLUDE_DIRECTORIES "${OpusFile_dirs};${Ogg_dirs}"
             INTERFACE_COMPILE_OPTIONS "${OpusFile_COMPILE_OPTIONS}"
             INTERFACE_LINK_LIBRARIES "${OpusFile_LINK_LIBRARIES}"
             INTERFACE_LINK_OPTIONS "${OpusFile_LINK_OPTIONS}"