cmake: Update use of MbedTLS to support versions 3.6.0 and beyond
Description
Update MbedTLS find module and usage in CMake files to prepare codebase for later update to CMake version 3.6.0 and beyond.
Motivation and Context
MbedTLS changed a lot of internals with their LTS version 3.6.0, which are incompatible with the find module currently shipped with OBS Studio.
The solution requires several changes to be applied at once:
- Rename the generated target name to MbedTLS::mbedtls to match the name used by MbedTLS' own CMake package
- Update find module to use the updated target name(s)
- Set CMAKE_FIND_PACKAGE_PREFER_CONFIG to TRUE before trying to find MbedTLS to ensure that CMake package files are used with priority (Those are shipped only with MbedTLS 3.6.0 in obs-deps).
- A deprecation warning is emitted if the find module is used with MbedTLS 3.6.0 available
How Has This Been Tested?
Tested on macOS with either current MbedTLS version provided by obs-deps as well as MbedTLS 3.6.0 provided via its own CMake package.
Types of changes
- Bug fix (non-breaking change which fixes an issue)
Checklist:
- [x] My code has been run through clang-format.
- [x] I have read the contributing document.
- [x] My code is not on the master branch.
- [x] The code has been tested.
- [x] All commit messages are properly formatted and commits squashed where appropriate.
- [x] I have included updates to all appropriate documentation.
3.6.0 caused a breakage (which break RTMPS), until MbedTLS fix their mess with a bugfix release. I don't think this PR should be "ready for review" since 3.6.0 can not be supported.
3.6.0 caused a breakage (which break RTMPS), until MbedTLS fix their mess with a bugfix release. I don't think this PR should be "ready for review"
It is, and also it needs to be merged before we update MbedTLS in obs-deps as that will immediately break the current codebase.
Thus we need to merge a forward-compatible change that will work with the current release of obs-deps as well as the future release which will be based of 3.6.0 or beyond and which creates CMake packages. There is currently no suggestion that the updated version of MbedTLS will not continue using its updated build system.
I, at least, think we should not advertise any support of version ==3.6.0 in any capacity.
This needs to be rebased and get CI to pass. IIRC, building SRT 1.5.x against mbedTLS 3.5.0+ fails because of changes in mbedTLS that needed addressed in libsrt, but there is no new libsrt tag with the needed changes. That being the case, we currently cannot update to mbedTLS 3.5+, but we can attempt to lay the foundation to allow building against newer versions so we don't have to juggle those changes in the future.
Requires a new obs-deps release with https://github.com/obsproject/obs-deps/pull/261 merged to fix macOS.