SDL: Added CMake option to disable the installer

From dc5bc5237c42d283d117e46130145adaa37dc575 Mon Sep 17 00:00:00 2001
From: Semphris <[EMAIL REDACTED]>
Date: Fri, 15 Apr 2022 17:11:29 -0400
Subject: [PATCH] Added CMake option to disable the installer

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9ee7ba16c0f..91636d2ae6c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -372,6 +372,7 @@ endforeach()
 
 # Allow some projects to be built conditionally.
 set_option(SDL2_DISABLE_SDL2MAIN   "Disable building/installation of SDL2main" OFF)
+set_option(SDL2_DISABLE_INSTALL    "Disable installation of SDL2" OFF)
 set_option(SDL2_DISABLE_UNINSTALL  "Disable uninstallation of SDL2" OFF)
 
 option_string(SDL_ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto")
@@ -2968,6 +2969,7 @@ if(SDL_TEST)
 endif()
 
 ##### Installation targets #####
+if(NOT SDL2_DISABLE_INSTALL)
 if(SDL_SHARED)
   install(TARGETS SDL2 EXPORT SDL2Targets
     LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
@@ -3073,6 +3075,7 @@ if(NOT (WINDOWS OR CYGWIN) OR MINGW)
   # TODO: what about the .spec file? Is it only needed for RPM creation?
   install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/aclocal")
 endif()
+endif(NOT SDL2_DISABLE_INSTALL)
 
 ##### Uninstall target #####