SDL_image: cmake: don't enable -fPIC for platforms that don't support shared libraries

From be035537a9ee0e4990c57809446b4776754980cd Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Fri, 12 Jan 2024 23:36:25 +0100
Subject: [PATCH] cmake: don't enable -fPIC for platforms that don't support
 shared libraries

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ddbc2287..0e8d55f8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,7 +64,7 @@ if(VITA OR PSP OR PS2 OR N3DS OR RISCOS)
   set(PLATFORM_SUPPORTS_SHARED OFF)
 endif()
 
-option(CMAKE_POSITION_INDEPENDENT_CODE "Build static libraries with -fPIC" ON)
+option(CMAKE_POSITION_INDEPENDENT_CODE "Build static libraries with -fPIC" ${PLATFORM_SUPPORTS_SHARED})
 cmake_dependent_option(BUILD_SHARED_LIBS "Build the library as a shared library" ON PLATFORM_SUPPORTS_SHARED OFF)
 
 cmake_dependent_option(SDL3IMAGE_INSTALL "Enable SDL3_image install target" ${SDL3IMAGE_ROOTPROJECT} "${sdl3image_install_enableable}" OFF)