Module: kamailio
Branch: master
Commit: c8544e48710fa74150b958a1f8d1e918973afb51
URL: 
https://github.com/kamailio/kamailio/commit/c8544e48710fa74150b958a1f8d1e918973afb51

Author: Xenofon Karamanos <x...@gilawa.com>
Committer: Xenofon Karamanos <x...@gilawa.com>
Date: 2024-12-24T11:43:41Z

cmake: Fix docs readme target to not be cleaned.

---

Modified: cmake/modules-docs.cmake

---

Diff:  
https://github.com/kamailio/kamailio/commit/c8544e48710fa74150b958a1f8d1e918973afb51.diff
Patch: 
https://github.com/kamailio/kamailio/commit/c8544e48710fa74150b958a1f8d1e918973afb51.patch

---

diff --git a/cmake/modules-docs.cmake b/cmake/modules-docs.cmake
index c33c6ff5363..b4d996bc9e0 100644
--- a/cmake/modules-docs.cmake
+++ b/cmake/modules-docs.cmake
@@ -85,28 +85,27 @@ else()
     add_custom_target(
       ${MODULE_NAME}_doc_text
       DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}/${MODULE_NAME}.txt
-      COMMENT "Processing target ${MODULE_NAME}_doc_text"
-    )
+      COMMENT "Processing target ${MODULE_NAME}_doc_text")
 
+    # This is essentialy an alias of doc_text target but with extra copy
+    # command to copy the text file to the source tree directory.
     add_custom_target(
       ${MODULE_NAME}_readme
-      DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${MODULE_NAME}/README
-      COMMENT "Processing target ${MODULE_NAME}_readme"
-    )
+      DEPENDS ${MODULE_NAME}_doc_text
+      COMMENT "Processing target ${MODULE_NAME}_readme")
 
     add_custom_target(
       ${MODULE_NAME}_doc_html
       DEPENDS ${DOCS_OUTPUT_DIR}/${MODULE_NAME}.html
-      COMMENT "Processing target ${MODULE_NAME}_doc_html"
-    )
+      COMMENT "Processing target ${MODULE_NAME}_doc_html")
 
     add_custom_target(
       ${MODULE_NAME}_doc
       DEPENDS ${MODULE_NAME}_doc_text ${MODULE_NAME}_doc_html
-      COMMENT "Processing target ${MODULE_NAME}_doc"
-    )
+              ${MODULE_NAME}_readme
+      COMMENT "Processing target ${MODULE_NAME}_doc")
 
-    # Each version has seperate custon coommands for not recompiling all if 1
+    # Each version has seperate custon commands for not recompiling all if 1
     # gets changed.
     if(XSLTPROC_EXECUTABLE)
       if(LYNX_EXECUTABLE)
@@ -127,15 +126,16 @@ else()
             "Generating text documentation with xsltproc and lynx for 
${MODULE_NAME}"
         )
 
+        # Add custom command to copy the README file after the readme target 
is built.
+        # The readme target depends on doc_text so it will regenerate if it's 
input changed.
         add_custom_command(
-          OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${MODULE_NAME}/README
+          TARGET ${MODULE_NAME}_readme
+          POST_BUILD
           COMMAND
             ${CMAKE_COMMAND} -E copy
             ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}/${MODULE_NAME}.txt
             ${CMAKE_CURRENT_SOURCE_DIR}/${MODULE_NAME}/README
-          DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}/${MODULE_NAME}.txt
-          COMMENT "Generating README file for module ${MODULE_NAME}"
-        )
+          COMMENT "Copying README file to source tree for ${MODULE_NAME}")
 
         add_custom_command(
           OUTPUT ${DOCS_OUTPUT_DIR}/${MODULE_NAME}.html

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to