SDL_ttf: cmake: add option to install man pages

From e44fdaa9aa974031c495e9988ec305805c3443da Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Tue, 27 Jun 2023 05:03:10 +0200
Subject: [PATCH] cmake: add option to install man pages

---
 .wikiheaders-options | 4 ++--
 CMakeLists.txt       | 7 +++++++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/.wikiheaders-options b/.wikiheaders-options
index 6644723..efde948 100644
--- a/.wikiheaders-options
+++ b/.wikiheaders-options
@@ -3,8 +3,8 @@ projectshortname = SDL_ttf
 incsubdir = include/SDL3
 wikisubdir = SDL3_ttf
 apiprefixregex = TTF_
-mainincludefname = SDL_ttf.h
-versionfname = SDL_ttf.h
+mainincludefname = SDL3/SDL_ttf.h
+versionfname = include/SDL3/SDL_ttf.h
 versionmajorregex = \A\#define\s+SDL_TTF_MAJOR_VERSION\s+(\d+)\Z
 versionminorregex = \A\#define\s+SDL_TTF_MINOR_VERSION\s+(\d+)\Z
 versionpatchregex = \A\#define\s+SDL_TTF_PATCHLEVEL\s+(\d+)\Z
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 80aed29..f74a334 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,6 +52,7 @@ option(CMAKE_POSITION_INDEPENDENT_CODE "Build static libraries with -fPIC" ON)
 option(BUILD_SHARED_LIBS "Build the library as a shared library" ON)
 
 cmake_dependent_option(SDL3TTF_INSTALL "Enable SDL3_ttf install target" ${SDL3TTF_ROOTPROJECT} "${sdl3ttf_install_enableable}" OFF)
+cmake_dependent_option(SDL3TTF_INSTALL_MAN "Install man pages for SDL3_ttf" ${SDL3TTF_ROOTPROJECT} "SDL3TTF_INSTALL" OFF)
 option(SDL3TTF_VENDORED "Use vendored third-party libraries" ${vendored_default})
 option(SDL3TTF_WERROR "Treat warnings as errors" OFF)
 
@@ -334,6 +335,12 @@ if(SDL3TTF_INSTALL)
         DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${PROJECT_NAME}"
         COMPONENT library
     )
+
+    if(SDL3TTF_INSTALL_MAN AND COMMAND SDL_generate_manpages)
+        SDL_generate_manpages(
+            SYMBOL "TTF_Init"
+        )
+    endif()
 endif()
 
 if(SDL3TTF_SAMPLES)