SDL_image: Fixed disabling the zlib installer

From 915b794f2c6d8247f775000ee0b96f660cbb9331 Mon Sep 17 00:00:00 2001
From: Semphris <[EMAIL REDACTED]>
Date: Fri, 15 Apr 2022 17:21:21 -0400
Subject: [PATCH] Fixed disabling the zlib installer

---
 CMakeLists.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index fa6358b..b70d39a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -60,6 +60,9 @@ if (SUPPORT_PNG)
 	target_compile_definitions(SDL2_image PRIVATE -DLOAD_PNG)
 
 	if (NOT TARGET zlib)
+		# SDL_image doesn't support installing currently
+		set(SKIP_INSTALL_ALL ON CACHE BOOL "" FORCE)
+
 		# if zlib not included from another source, add_subdirectory
 		add_subdirectory(external/zlib-1.2.12)
 
@@ -72,9 +75,6 @@ if (SUPPORT_PNG)
 		else()
 			set(ZLIB_LIBRARY zlibstatic)
 		endif()
-
-		# SDL_image doesn't support installing currently
-		set(SKIP_INSTALL_ALL ON)
 	endif()
 
 	add_subdirectory(external/libpng-1.6.37)