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

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

ndb_mongodb: Adopte cmake for mongoc2

---

Modified: src/modules/ndb_mongodb/CMakeLists.txt

---

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

---

diff --git a/src/modules/ndb_mongodb/CMakeLists.txt 
b/src/modules/ndb_mongodb/CMakeLists.txt
index ab5759f521b..60c730d88ba 100644
--- a/src/modules/ndb_mongodb/CMakeLists.txt
+++ b/src/modules/ndb_mongodb/CMakeLists.txt
@@ -3,7 +3,17 @@ file(GLOB MODULE_SOURCES "*.c")
 add_library(${module_name} SHARED ${MODULE_SOURCES})
 
 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 "libmongoc-1.0 not found! Please install 
libmongoc-1.0-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