Make libmongoc a sub-project in mongo-c-driver (CDRIVER-2505)

[CDRIVER-2649] Cannot make install just libbson without building libmongoc Created: 07/May/18  Updated: 28/Oct/23  Resolved: 17/May/18

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Sub-task Priority: Major - P3
Reporter: Kevin Albertson Assignee: Roberto Sanchez
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

If we build just libbson

cd mongo-c-driver
mkdir cmake-build && cd cmake-build
cmake -DCMAKE_INSTALL_PREFIX=/tmp/cdriver ../
make bson_shared

This builds bson_shared only, as expected. However, doing make install proceeds to build all of the C driver.

A potential solution is to introduce a CMake option to disable building libmongoc.



 Comments   
Comment by A. Jesse Jiryu Davis [ 17/May/18 ]

Fixed in CDRIVER-2416

Comment by Roberto Sanchez [ 08/May/18 ]

So, we apparently already solved this particular problem. It was under CDRIVER-2416, commit e025efb85. Basically, you can do this to get just libbson:

cd mongo-c-driver
mkdir cmake-build && cd cmake-build
cmake -DENABLE_BSON=ONLY -DCMAKE_INSTALL_PREFIX=/tmp/cdriver ../
make && make install

The documentation was updated as part of CDRIVER-2513, commit 58441ffe1.

That said, I am playing around with the options now that we are making libmongoc and libbson sibling project. If we have ENABLE_MONGOC with ON/OFF as the options, then we can safely discard ENABLE_BSON=ONLY and instead rely on the ENABLE_MONGOC value. It would probably also make sense to add ON and OFF as valid ENABLE_BSON values which alias to BUNDLED and SYSTEM, respectively.

I'll try to come up with a sensible set of options and settings and we can hash it out in code review.

Comment by A. Jesse Jiryu Davis [ 07/May/18 ]

perhaps the API should be:

cmake -DENABLE_MONGOC=OFF ..
make install

The ENABLE_MONGOC flag would be a regular option (so it has values ON or OFF), default is ON.

Generated at Wed Feb 07 21:15:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.