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

Author: Xenofon Karamanos <[email protected]>
Committer: Xenofon Karamanos <[email protected]>
Date: 2026-01-27T12:05:59Z

cmake: Add dbschema to default target

- if xsltproc is found, add the dbschema to default/all target
- if xsltproc is not found, dbschema target is not created either way.
- Allow cleanup of the db files with global target clean.

---

Modified: cmake/dbschema.cmake

---

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

---

diff --git a/cmake/dbschema.cmake b/cmake/dbschema.cmake
index de0f1ef7875..690adaa9491 100644
--- a/cmake/dbschema.cmake
+++ b/cmake/dbschema.cmake
@@ -90,6 +90,14 @@ function(add_db_target db_name xsl_file)
       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/src/lib/srdb1/schema"
       COMMENT "Processing ${table} for ${db_name}"
     )
+    # Ensure the generated files are cleaned up by the global clean target
+    # Note: this only works for CMake >= 3.15 and only for Make and Ninja 
generators
+    if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.15")
+      set_target_properties(
+        dbschema_${db_name} PROPERTIES ADDITIONAL_CLEAN_FILES
+                                       
"${CMAKE_BINARY_DIR}/utils/kamctl/${db_name_folder}/"
+      )
+    endif()
   endforeach()
 
   # Create version table for db_text
@@ -135,7 +143,7 @@ if(NOT XSLTPROC_EXECUTABLE)
 else()
   #  Add targets for each database type
   if(NOT TARGET dbschema)
-    add_custom_target(dbschema COMMENT "Generating schemas for all dbs...")
+    add_custom_target(dbschema ALL COMMENT "Generating schemas for all dbs...")
   endif()
   if(NOT TARGET dbschema_clean)
     add_custom_target(dbschema_clean COMMENT "Cleaning schemas for all dbs...")

_______________________________________________
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