From 8710e0ae01220b22a7214a47109027581f97a1a0 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Wed, 27 Dec 2023 17:27:14 +0700 Subject: [PATCH] DONT MERGE --- CMakeLists.txt | 9 ++++++++- cmake/GenerateDocs.cmake | 13 +++++++++++++ cmake/add_xml_docs.cmake | 13 ------------- 3 files changed, 21 insertions(+), 14 deletions(-) create mode 100644 cmake/GenerateDocs.cmake delete mode 100644 cmake/add_xml_docs.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index a517bf2..69b03d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,8 +66,15 @@ if(NOT_SUBPROJECT) catch_discover_tests(errors_test) endif() - # Build XML documentation + # Build documentation. if(BUILD_DOCS) + find_package(Doxygen REQUIRED) + + # Configure Doxygen to generate XML documentation. + set(DOXYGEN_GENERATE_HTML NO) + set(DOXYGEN_GENERATE_XML YES) + set(DOXYGEN_XML_OUTPUT ${TARGET_NAME}) + include(cmake/add_xml_docs.cmake) add_xml_docs(errors_docs include/errors/error.hpp) endif() diff --git a/cmake/GenerateDocs.cmake b/cmake/GenerateDocs.cmake new file mode 100644 index 0000000..215fd89 --- /dev/null +++ b/cmake/GenerateDocs.cmake @@ -0,0 +1,13 @@ +# Function to generate an XML documentation of a specific target. +# Arguments: +# - TARGET: The target for which to generate an XML documentation. +function(target_generate_xml_docs TARGET) + find_package(Doxygen REQUIRED) + + # Configure Doxygen to generate an XML documentation. + set(DOXYGEN_GENERATE_HTML NO) + set(DOXYGEN_GENERATE_XML YES) + set(DOXYGEN_XML_OUTPUT ${TARGET}_docs) + + doxygen_add_docs(${TARGET_NAME}_docs ${ARGN} USE_STAMP_FILE) +endfunction() diff --git a/cmake/add_xml_docs.cmake b/cmake/add_xml_docs.cmake deleted file mode 100644 index 525624a..0000000 --- a/cmake/add_xml_docs.cmake +++ /dev/null @@ -1,13 +0,0 @@ -# A function that generates XML documentation from the specified source files. -function(add_xml_docs TARGET_NAME) - # Try to find Doxygen - find_package(Doxygen REQUIRED) - - # Configure Doxygen to generate XML documentation - set(DOXYGEN_GENERATE_HTML NO) - set(DOXYGEN_GENERATE_XML YES) - set(DOXYGEN_XML_OUTPUT ${TARGET_NAME}) - - # Generate XML documentation for the target - doxygen_add_docs(${TARGET_NAME} ${ARGN} USE_STAMP_FILE) -endfunction()