From a74c96695b40e1b9eebe884a4c74fca9c43ab7bd Mon Sep 17 00:00:00 2001
From: Timm Fitschen <t.fitschen@indiscale.com>
Date: Tue, 22 Jun 2021 13:38:51 +0200
Subject: [PATCH] fix docs

---
 doc/CMakeLists.txt                  | 18 +++++++++++++-----
 doc/Doxyfile.in                     |  2 +-
 doc/api/header_file.rst.in          |  2 +-
 doc/api/{index.rst => index.rst.in} |  0
 doc/{index.rst => index.rst.in}     |  0
 5 files changed, 15 insertions(+), 7 deletions(-)
 rename doc/api/{index.rst => index.rst.in} (100%)
 rename doc/{index.rst => index.rst.in} (100%)

diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index b35e33a..ee77438 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -21,6 +21,7 @@
 find_package(Doxygen)
 
 if (DOXYGEN_FOUND)
+    string(REPLACE ";" " " DOXYGEN_INPUT "${libcaosdb_INCL}")
     configure_file(Doxyfile.in Doxyfile)
 
     # Note: do not put "ALL" - this builds docs together with application EVERY TIME!
@@ -33,20 +34,27 @@ if (DOXYGEN_FOUND)
     find_program(SPHINX_CMD sphinx-build)
     if (SPHINX_CMD)
         configure_file(conf.py.in conf.py)
+        configure_file(index.rst.in index.rst)
+        configure_file(api/index.rst.in api/index.rst)
 
         # create rst pages for every header file
         list(LENGTH libcaosdb_INCL len_header_files)
         math(EXPR len_header_files "${len_header_files} - 1")
         foreach (i RANGE "${len_header_files}")
-            list(GET libcaosdb_INCL ${i} HEADER_FILE_NAME)
+            list(GET libcaosdb_INCL ${i} HEADER_FILE)
             string(REPLACE
-                "include/"
+                "${PROJECT_INCLUDE_DIR}/"
+                ""
+                HEADER_FILE_NAME
+                ${HEADER_FILE})
+            string(REPLACE
+                "${CMAKE_BINARY_DIR}/include/"
                 ""
                 HEADER_FILE_NAME
                 ${HEADER_FILE_NAME})
             configure_file(
-                ${CMAKE_CURRENT_SOURCE_DIR}/api/header_file.rst.in
-                ${CMAKE_CURRENT_SOURCE_DIR}/api/_${HEADER_FILE_NAME}.rst)
+                api/header_file.rst.in
+                api/_${HEADER_FILE_NAME}.rst)
         endforeach ()
 
         add_custom_target(doc-sphinx
@@ -54,7 +62,7 @@ if (DOXYGEN_FOUND)
                 -b html
                 -n
                 -c ${CMAKE_CURRENT_BINARY_DIR}
-                ${CMAKE_CURRENT_SOURCE_DIR}
+                ${CMAKE_CURRENT_BINARY_DIR}
                 sphinx_out
             DEPENDS doc-doxygen
             WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in
index 0b12227..d0f329b 100644
--- a/doc/Doxyfile.in
+++ b/doc/Doxyfile.in
@@ -864,7 +864,7 @@ WARN_LOGFILE           =
 # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
 # Note: If this tag is empty the current directory is searched.
 
-INPUT                  = @PROJECT_INCLUDE_DIR@
+INPUT                  = @DOXYGEN_INPUT@
 
 
 # This tag can be used to specify the character encoding of the source files
diff --git a/doc/api/header_file.rst.in b/doc/api/header_file.rst.in
index 78a2414..03b7674 100644
--- a/doc/api/header_file.rst.in
+++ b/doc/api/header_file.rst.in
@@ -28,5 +28,5 @@
 .. toctree::
     :hidden:
 
-.. doxygenfile:: @HEADER_FILE_NAME@
+.. doxygenfile:: @HEADER_FILE@
    :project: libcaosdb
diff --git a/doc/api/index.rst b/doc/api/index.rst.in
similarity index 100%
rename from doc/api/index.rst
rename to doc/api/index.rst.in
diff --git a/doc/index.rst b/doc/index.rst.in
similarity index 100%
rename from doc/index.rst
rename to doc/index.rst.in
-- 
GitLab