# SDL\_image: cmake: don't buid SDL\_image as a shared library for platforms that don't support it

**URL:** <https://discourse.libsdl.org/t/sdl-image-cmake-dont-buid-sdl-image-as-a-shared-library-for-platforms-that-dont-support-it/48277>\
**Category:** SDL Commits\
**Created:** [January 12, 2024, 2:54pm UTC](https://discourse.libsdl.org/t/sdl-image-cmake-dont-buid-sdl-image-as-a-shared-library-for-platforms-that-dont-support-it/48277 "2024-01-12T14:54:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [January 12, 2024, 2:54pm UTC](https://discourse.libsdl.org/t/sdl-image-cmake-dont-buid-sdl-image-as-a-shared-library-for-platforms-that-dont-support-it/48277/1 "2024-01-12T14:54:03Z")

</div>

> <https://github.com/libsdl-org/SDL_image/commit/ee9dd0314f9c1c86d771abb53cccc8daf2680d99>

```diff
From ee9dd0314f9c1c86d771abb53cccc8daf2680d99 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Fri, 12 Jan 2024 15:53:05 +0100
Subject: [PATCH] cmake: don't buid SDL_image as a shared library for platforms
 that don't support it

---
 CMakeLists.txt | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 401400da..695d23f1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -59,8 +59,13 @@ include(CMakeDependentOption)
 include(CMakePackageConfigHelpers)
 include(GNUInstallDirs)
 
+set(BUILD_SHARED_LIBS_DEFAULT ON)
+if(VITA OR PSP OR PS2 OR N3DS OR RISCOS)
+ set(BUILD_SHARED_LIBS_DEFAULT OFF)
+endif()
+
 option(CMAKE_POSITION_INDEPENDENT_CODE "Build static libraries with -fPIC" ON)
-option(BUILD_SHARED_LIBS "Build the library as a shared library" ON)
+option(BUILD_SHARED_LIBS "Build the library as a shared library" ${BUILD_SHARED_LIBS_DEFAULT})
 
 cmake_dependent_option(SDL3IMAGE_INSTALL "Enable SDL3_image install target" ${SDL3IMAGE_ROOTPROJECT} "${sdl3image_install_enableable}" OFF)
 cmake_dependent_option(SDL3IMAGE_INSTALL_CPACK "Create binary SDL3_image archive using CPack" ${SDL3IMAGE_ROOTPROJECT} "SDL3IMAGE_INSTALL" OFF)

```
