SDL_image: cmake: create wiki dir before running wikiheaders.pl --copy-to-wiki

From 9d5211339a35b7bb729fbb0a73e20bb613b5bb99 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Wed, 28 Jun 2023 14:54:48 +0200
Subject: [PATCH] cmake: create wiki dir before running wikiheaders.pl
 --copy-to-wiki

---
 CMakeLists.txt          | 2 +-
 cmake/sdlmanpages.cmake | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 27c75615..183af295 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -771,7 +771,7 @@ if(SDL3IMAGE_INSTALL)
         COMPONENT library
     )
 
-    if(SDL3IMAGE_INSTALL_MAN AND COMMAND SDL_generate_manpages)
+    if(SDL3IMAGE_INSTALL_MAN)
         SDL_generate_manpages(
             SYMBOL "IMG_Init"
             WIKIHEADERS_PL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build-scripts/wikiheaders.pl"
diff --git a/cmake/sdlmanpages.cmake b/cmake/sdlmanpages.cmake
index 9d11c9ba..0049de1f 100644
--- a/cmake/sdlmanpages.cmake
+++ b/cmake/sdlmanpages.cmake
@@ -39,6 +39,7 @@ function(SDL_generate_manpages)
   if(PERL_FOUND AND EXISTS "${ARG_WIKIHEADERS_PL_PATH}")
     add_custom_command(
       OUTPUT "${BUILD_WIKIDIR}/${ARG_SYMBOL}.md"
+      COMMAND "${CMAKE_COMMAND}" -E make_directory "${BUILD_WIKIDIR}"
       COMMAND "${PERL_EXECUTABLE}" "${ARG_WIKIHEADERS_PL_PATH}" "${ARG_SOURCE_DIR}" "${BUILD_WIKIDIR}" "--options=${ARG_OPTION_FILE}" --copy-to-wiki
       DEPENDS ${HEADER_FILES} "${ARG_WIKIHEADERS_PL_PATH}" "${ARG_OPTION_FILE}"
       COMMENT "Generating ${ARG_NAME} wiki markdown files"