SDL_helloworld: cmake: build SDL_helloworld as a shared library on Android

From 6a88efdf5916f0238d187dd1db9727f86fb1400b Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Sat, 2 Nov 2024 03:47:49 +0100
Subject: [PATCH] cmake: build SDL_helloworld as a shared library on Android

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 804fd2b..3ad3785 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,6 +22,13 @@ else()
     find_package(SDL3 CONFIG REQUIRED)
 endif()
 
+if(ANDROID)
+    # SDL applications need to be built as a shared library
+    function(add_executable TARGET)
+        add_library(${TARGET} SHARED ${ARGN})
+    endfunction()
+endif()
+
 add_executable(sdl-helloworld
     main.c
 )