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

Author: Xenofon Karamanos <x...@gilawa.com>
Committer: Victor Seva <linuxman...@torreviejawireless.org>
Date: 2025-08-28T15:59:10+02:00

db_mongodb: Adopt cmake for mongoc2

---

Modified: src/modules/db_mongodb/CMakeLists.txt

---

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

---

diff --git a/src/modules/db_mongodb/CMakeLists.txt 
b/src/modules/db_mongodb/CMakeLists.txt
index 9bf0729e107..f18c55cdee7 100644
--- a/src/modules/db_mongodb/CMakeLists.txt
+++ b/src/modules/db_mongodb/CMakeLists.txt
@@ -5,7 +5,17 @@ add_library(${module_name} SHARED ${MODULE_SOURCES})
 # libmongoc-1.0 is required for this module Missing dependency on Ubuntu 20.04
 # of libzstd-dev find_package(zstd REQUIRED)
 find_package(PkgConfig REQUIRED)
-pkg_check_modules(mongoc REQUIRED IMPORTED_TARGET libmongoc-1.0>=1.7)
-add_library(mongoc::mongoc ALIAS PkgConfig::mongoc)
+pkg_check_modules(mongoc2 IMPORTED_TARGET mongoc2)
+
+if(mongoc2_FOUND)
+  add_library(mongoc::mongoc ALIAS PkgConfig::mongoc2)
+else()
+  pkg_check_modules(mongoc IMPORTED_TARGET libmongoc-1.0>=1.7)
+  if(NOT mongoc_FOUND)
+    message(FATAL_ERROR "mongoc or mongoc2 not found! Please install 
libmongoc-dev.")
+  endif()
+  add_library(mongoc::mongoc ALIAS PkgConfig::mongoc)
+  target_compile_definitions(${module_name} PRIVATE HAVE_LIBMONGOC1)
+endif()
 
 target_link_libraries(${module_name} PRIVATE mongoc::mongoc)

_______________________________________________
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