Commit dc5bc5237c42d283d117e46130145adaa37dc575

Semphris 2022-04-15T17:11:29

Added CMake option to disable the installer

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9ee7ba1..91636d2 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 #####