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

Author: Xenofon Karamanos <[email protected]>
Committer: Xenofon Karamanos <[email protected]>
Date: 2025-12-18T15:33:33Z

cmake: Adopt sed commands for ctl and db files

- Move dir defintions to defs.cmake for visibility from other modules
- Add missing replacements in sed command

---

Modified: cmake/db_files.cmake
Modified: cmake/defs.cmake
Modified: utils/kamctl/CMakeLists.txt

---

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

---

diff --git a/cmake/db_files.cmake b/cmake/db_files.cmake
index d491ddaea47..89ea86129ef 100644
--- a/cmake/db_files.cmake
+++ b/cmake/db_files.cmake
@@ -2,14 +2,17 @@
 # It takes the group name, the file name and a boolean to determine if it is 
for kamctl or kamdbctl
 # It processes the file with sed and installs it to the correct location
 # Used by the helper function add_kamctl_db_files and add_kamdbctl_db_files
+
 function(add_db_files group_name file kamctl)
   # message(WARNING "file name is ${file}")
   # message(WARNING "group name is ${group_name}")
   # Process the file with sed and install it
   add_custom_command(
     OUTPUT "${CMAKE_BINARY_DIR}/utils/kamctl/${file}"
-    COMMAND sed -e "s#/usr/local/sbin#${BIN_DIR}#g" < 
${CMAKE_SOURCE_DIR}/utils/kamctl/${file} >
-            ${CMAKE_BINARY_DIR}/utils/kamctl/${file}
+    COMMAND
+      sed -e "s#/usr/local/sbin#${BIN_DIR}#g" -e 
"s#/usr/local/share/kamailio#${SHARE_DIR}#g" -e
+      "s#/usr/local/etc/kamailio#${CFG_DIR}#g" < 
${CMAKE_SOURCE_DIR}/utils/kamctl/${file} >
+      ${CMAKE_BINARY_DIR}/utils/kamctl/${file}
     COMMENT "Processed ${file} with sed "
   )
 
diff --git a/cmake/defs.cmake b/cmake/defs.cmake
index e68e593a783..6124200c9e9 100644
--- a/cmake/defs.cmake
+++ b/cmake/defs.cmake
@@ -5,6 +5,19 @@
 
 include(CMakeDependentOption) # cmake_dependent_option
 
+# Define full paths for installation directories with name of the project
+# appended where needed. These are used in various places to define paths in
+# config files and scripts using sed for the most part or install(CODE) 
scripts.
+# For relative paths use the CMAKE_INSTALL_xxxDIR variables directly provided
+# by CMake module GNUInstallDirs.
+# If you need to change path for one of these directories, change the 
respective
+# CMAKE_INSTALL_xxxDIR variable when invoking cmake, e.g.:
+# cmake -DCMAKE_INSTALL_SBINDIR=custom/sbin ...
+set(BIN_DIR "${CMAKE_INSTALL_FULL_SBINDIR}")
+set(LIB_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/${MAIN_NAME}")
+set(CFG_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/${MAIN_NAME}")
+set(SHARE_DIR "${CMAKE_INSTALL_FULL_DATADIR}/${MAIN_NAME}")
+
 add_library(common INTERFACE)
 
 # This interface is populated by common and some extra module specific flags
diff --git a/utils/kamctl/CMakeLists.txt b/utils/kamctl/CMakeLists.txt
index 68d8764ffbd..80c70544fd1 100644
--- a/utils/kamctl/CMakeLists.txt
+++ b/utils/kamctl/CMakeLists.txt
@@ -2,11 +2,6 @@ project(kamailio_utils)
 
 get_property(FINAL_MODULES_LIST GLOBAL PROPERTY ADDED_MODULES_LIST)
 
-set(BIN_DIR "${CMAKE_INSTALL_FULL_SBINDIR}")
-set(LIB_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/${MAIN_NAME}")
-set(CFG_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/${MAIN_NAME}")
-set(SHARE_DIR "${CMAKE_INSTALL_FULL_DATADIR}/${MAIN_NAME}")
-
 include(${CMAKE_SOURCE_DIR}/cmake/db_files.cmake)
 
 # --- kamctl  ---

_______________________________________________
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