SDL_image: cmake: look for libavif 0.9.3 and 1.0 in SDL2_imageConfig.cmake

From 0c34e8c1363eadb41ea0b944e8c3e0adcc69ff9c Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Sat, 9 Sep 2023 00:53:52 +0200
Subject: [PATCH] cmake: look for libavif 0.9.3 and 1.0 in
 SDL2_imageConfig.cmake

---
 SDL2_imageConfig.cmake.in | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/SDL2_imageConfig.cmake.in b/SDL2_imageConfig.cmake.in
index ae387195..c59e8449 100644
--- a/SDL2_imageConfig.cmake.in
+++ b/SDL2_imageConfig.cmake.in
@@ -45,7 +45,14 @@ endif()
 include(CMakeFindDependencyMacro)
 
 if(SDL2IMAGE_AVIF AND NOT SDL2IMAGE_VENDORED AND NOT TARGET avif)
-    find_dependency(libavif @LIBAVIF_MINIMUM_VERSION@)
+    find_package(libavif 1.0 QUIET)
+    if(NOT libavif_FOUND)
+        find_package(libavif @LIBAVIF_MINIMUM_VERSION@ QUIET)
+    endif()
+    if(NOT libavif_FOUND)
+        set(SDL3_image_FOUND FALSE)
+        return()
+    endif()
 endif()
 
 if(SDL2IMAGE_JPG AND NOT SDL2IMAGE_VENDORED AND NOT TARGET JPEG::JPEG)