SDL_rtf: cmake: build static library by default for platforms that don't support shared libraries

From 552353e7b8728c2faaeb8a4c0e0dafdb5fb3727b Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Mon, 15 Jan 2024 13:18:53 +0100
Subject: [PATCH] cmake: build static library by default for platforms that
 don't support shared libraries

---
 CMakeLists.txt | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index efb6efa..f0a6322 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,8 +52,13 @@ include(CMakePackageConfigHelpers)
 include(GNUInstallDirs)
 include(CheckSymbolExists)
 
-option(CMAKE_POSITION_INDEPENDENT_CODE "Build static libraries with -fPIC" ON)
-option(BUILD_SHARED_LIBS "Build the library as a shared library" ON)
+set(PLATFORM_SUPPORTS_SHARED ON)
+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" ${PLATFORM_SUPPORTS_SHARED})
+cmake_dependent_option(BUILD_SHARED_LIBS "Build the library as a shared library" ON PLATFORM_SUPPORTS_SHARED OFF)
 
 cmake_dependent_option(SDL3RTF_INSTALL "Enable SDL3_rtf install target" ${SDL3RTF_ROOTPROJECT} "${sdl3rtf_install_enableable}" OFF)
 cmake_dependent_option(SDL3RTF_INSTALL_MAN "Install man pages for SDL3_rtf" ${SDL3RTF_ROOTPROJECT} "SDL3RTF_INSTALL" OFF)