Module: kamailio
Branch: 6.0
Commit: ed97f6fef8c915f728463d12024a85d0c16e9664
URL: 
https://github.com/kamailio/kamailio/commit/ed97f6fef8c915f728463d12024a85d0c16e9664

Author: Xenofon Karamanos <[email protected]>
Committer: Henning Westerholt <[email protected]>
Date: 2026-03-11T09:23:58Z

cmake: Update dbschema generation flow

- dbschema will build schema files into db files and copy them to source 
directory

- install will copy source tree files (utils/kamctl/db*) to install folder

(cherry picked from commit 9631c04c09fa128718ecd0fa0cb614188625fafd)
(cherry picked from commit b97ca6ff380060e5c2ce5385dc87da627c6be231)

---

Modified: cmake/dbschema.cmake

---

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

---

diff --git a/cmake/dbschema.cmake b/cmake/dbschema.cmake
index d30014cbaaa..590231a7170 100644
--- a/cmake/dbschema.cmake
+++ b/cmake/dbschema.cmake
@@ -28,6 +28,7 @@ function(add_db_target db_name xsl_file)
   endif()
 
   find_group_name(${db_name_folder})
+  # message(WARNING "group name is ${group_name}")
 
   add_custom_target(
     dbschema_${db_name}
@@ -127,14 +128,25 @@ function(add_db_target db_name xsl_file)
   add_dependencies(dbschema dbschema_${db_name})
   add_dependencies(dbschema_clean dbschema_${db_name}_clean)
 
-  # message(WARNING "group name is ${group_name}")
-  # Before installing, ensure the target is built `dbschema_${db_name}`
-  # install as previously done in makefile folder. see naming above
-  # TODO: when tools adopt to new folder structure, replace the install_folder 
variable
-  # with ${db_name_folder}
+  # When a schema file is updated, we should run the `dbschema_${db_name}`
+  # target to update the generated schema files in the source directory.
+  # TODO: when tools adopt to new folder structure, replace the install_folder
+  # variable with ${db_name_folder}
+
+  # Copy the generated schema files to the source directory
+  add_custom_command(
+    TARGET dbschema_${db_name}
+    POST_BUILD
+    COMMAND
+      ${CMAKE_COMMAND} -E copy_directory
+      "${CMAKE_BINARY_DIR}/utils/kamctl/${db_name_folder}/${folder_suffix}"
+      "${CMAKE_SOURCE_DIR}/utils/kamctl/${install_folder}/${folder_suffix}"
+    COMMENT "Copying generated schema files for ${db_name} to source directory"
+  )
 
+  # Install from source tree (should always be up to date)
   install(
-    DIRECTORY ${CMAKE_BINARY_DIR}/utils/kamctl/${db_name_folder}/
+    DIRECTORY ${CMAKE_SOURCE_DIR}/utils/kamctl/${install_folder}/
     DESTINATION ${CMAKE_INSTALL_DATADIR}/${MAIN_NAME}/${install_folder}
     OPTIONAL
     COMPONENT ${group_name}

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to