Skip to content

feat mongo: add CMake support for mongo-c-driver 2.x.x#1175

Closed
botanegg wants to merge 1 commit into
userver-framework:developfrom
botanegg:userver-mongo-cmake-support-mongoc2
Closed

feat mongo: add CMake support for mongo-c-driver 2.x.x#1175
botanegg wants to merge 1 commit into
userver-framework:developfrom
botanegg:userver-mongo-cmake-support-mongoc2

Conversation

@botanegg
Copy link
Copy Markdown
Contributor


Note: by creating a PR or an issue you automatically agree to the CLA. See CONTRIBUTING.md. Feel free to remove this note, the agreement holds.

@botanegg botanegg force-pushed the userver-mongo-cmake-support-mongoc2 branch 3 times, most recently from 5227387 to 0d61ce8 Compare April 13, 2026 15:11
# prefer static libs here for compat
# https://github.com/mongodb/mongo-c-driver/blob/2.0.0/src/libmongoc/etc/mongocConfig.cmake.in#L7-L12
# mongoc::mongoc is mongoc::static first then mongoc::shared. Same for bson.
set(USERVER_MONGO_LIBMONGOC_NAME mongoc::mongoc)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не будет ли луяше сделать тут интерфейсные библиотеки mongo::mongoc_static и mongo::bson_static, и не трогать тогда файл mongo/CMakeLists.txt ?

Copy link
Copy Markdown
Contributor Author

@botanegg botanegg Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не оч понял, они и есть, если искать через v2 подход
Просто для них есть универсальный (на стороне либки) таргет, который делает то, что нужно (берет в приоритете статику, если статики нет, берет soшку)

А все трогание задумано, чтобы была совместимость между v1 и v2 и возможность сфоллбэчится на шаред либку для v2

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем появилась надобность:
у нас на archlinux, нету .a (и вообще поломан cmake для mongo-c-driver)

мейнтейнеры арчи не разрешают добавить
https://gitlab.archlinux.org/archlinux/packaging/packages/mongo-c-driver/-/work_items/4

Чтобы запускать юсервер с монгой нативно (удобно разрабатываться) - нужен фолбэк на шаред версию :(

@botanegg botanegg requested a review from apolukhin April 14, 2026 18:33
@botanegg botanegg force-pushed the userver-mongo-cmake-support-mongoc2 branch from 0d61ce8 to a10825c Compare April 18, 2026 19:12
@apolukhin
Copy link
Copy Markdown
Member

LGTM

@robot-magpie
Copy link
Copy Markdown

robot-magpie Bot commented Apr 23, 2026

Many thanks for the PR! @apolukhin is now importing your pull request into our internal upstream repository.

@robot-magpie
Copy link
Copy Markdown

robot-magpie Bot commented Apr 24, 2026

✅ This pull request is being closed because it has been successfully merged into our internal monorepository.
Your changes will be pushed to this repository soon. Thank you for your contribution!

@robot-magpie robot-magpie Bot closed this Apr 24, 2026
robot-piglet pushed a commit that referenced this pull request Apr 24, 2026
Tests: протестировано CI

---

Pull Request resolved: #1175
commit_hash:88404055d44e6643ddc912434617f36d8f288854
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants