vcpkg/ports/libvorbis/0004-ogg-find-dependency.patch
Julian Xhokaxhiu cec6b3798e
[libvorbis] Fix libogg find_package (#39067)
- [x] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [x] SHA512s are updated for each updated download.
- [ ] The "supports" clause reflects platforms that may be fixed by this
new version.
- [ ] Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.
- [ ] Any patches that are no longer applied are deleted from the port's
directory.
- [x] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [x] Only one version is added to each modified port's versions file.

---

Fix Ogg find_package.

Libogg now ships with an `OggConfig.cmake` file and the current way to
find it does not work anymore.
All the patch does adds the CONFIG notation to the find_package
function.

---

Repro case:

1. Add this to your own `vcpkg.json`
```json
{
  "name": "test",
  "version": "0.0.1",
  "dependencies": [
    {
      "name": "ffmpeg",
      "default-features": false,
      "features": [
        "vorbis"
      ],
      "platform": "windows"
    }
  ]
}
```

2. Add this line to your own `CMakeLists.txt`
```cmake
find_package(FFmpeg COMPONENTS AVFORMAT AVUTIL AVCODEC SWRESAMPLE)
```

3. See CMake failing with an error similar to this one:
```
CMake Error at REDACTED/vcpkg_installed/x86-windows-static/share/Vorbis/VorbisTargets.cmake:60 (set_target_properties):
  The link interface of target "Vorbis::vorbis" contains:

    Ogg::ogg

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  REDACTED/vcpkg_installed/x86-windows-static/share/Vorbis/VorbisConfig.cmake:30 (include)
  C:/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package)
  REDACTED/vcpkg_installed/x86-windows-static/share/ffmpeg/vcpkg-cmake-wrapper.cmake:190 (find_package)
  C:/vcpkg/scripts/buildsystems/vcpkg.cmake:813 (include)
  CMakeLists.txt:1 (find_package)
```

---------

Co-authored-by: Kai Pastor <dg0yt@darc.de>
2024-06-03 22:40:39 -07:00

14 lines
360 B
Diff

diff --git a/cmake/VorbisConfig.cmake.in b/cmake/VorbisConfig.cmake.in
index 6fc07941..c762ba55 100644
--- a/cmake/VorbisConfig.cmake.in
+++ b/cmake/VorbisConfig.cmake.in
@@ -1,7 +1,7 @@
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
-find_dependency(Ogg REQUIRED)
+find_dependency(Ogg CONFIG)
include(${CMAKE_CURRENT_LIST_DIR}/VorbisTargets.cmake)