SDL_image: cmake: set ZLIB_BUILD_EXAMPLES before configuring zlib

From a062e1268b09e496b4aa58a071298fe51965f087 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Mon, 29 Jan 2024 20:48:34 +0100
Subject: [PATCH] cmake: set ZLIB_BUILD_EXAMPLES before configuring zlib

---
 CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 06e18b0e..20a08c03 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -397,10 +397,10 @@ endif()
 if(SDL3IMAGE_ZLIB)
     if(SDL3IMAGE_ZLIB_VENDORED)
         message(STATUS "${PROJECT_NAME}: Using vendored zlib")
+        set(ZLIB_BUILD_EXAMPLES OFF CACHE BOOL "zlib examples" FORCE)
         sdl_check_project_in_subfolder(external/zlib zlib SDL3IMAGE_VENDORED)
         add_subdirectory(external/zlib EXCLUDE_FROM_ALL)
         # disable build of zlib example programs:
-        set(ZLIB_BUILD_EXAMPLES OFF CACHE BOOL "zlib examples" FORCE)
         # PNG_BUILD_ZLIB variable is used by vendored libpng
         set(PNG_BUILD_ZLIB ON CACHE BOOL "libpng option to tell it should use 'our' vendored ZLIB library" FORCE)
         # ZLIB_INCLUDE_DIR variable is used by vendored libpng