sdl12-compat: Support installing the library

From 9f2d88a343cc9fc43257147093b50a2aeed9af5a Mon Sep 17 00:00:00 2001
From: Neal Gompa <[EMAIL REDACTED]>
Date: Sat, 15 May 2021 14:45:10 -0400
Subject: [PATCH] Support installing the library

This adds minimal logic to support installing the library correctly
on various platforms when the install target is being used.

This makes it possible to build and install it for both native and
cross compile targets for Linux, macOS, and Windows.
---
 CMakeLists.txt | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index de3a974..4adade0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,6 +28,7 @@ set(SDL12COMPAT_SRCS
 )
 add_library(SDL SHARED ${SDL12COMPAT_SRCS})
 
+include(GNUInstallDirs)
 include("cmake/modules/FindSDL2.cmake")
 target_include_directories(SDL PRIVATE ${SDL2_INCLUDE_DIRS})
 
@@ -95,3 +96,7 @@ if(SDL12TESTS)
 
     test_program(testsprite "test/testsprite.c")
 endif()
+
+install(TARGETS SDL
+  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)