[CDRIVER-1948] CMake build should allow using bundled BSON Created: 09/Dec/16  Updated: 13/Feb/18  Resolved: 13/Feb/18

Status: Closed
Project: C Driver
Component/s: cmake
Affects Version/s: 1.5.0
Fix Version/s: 1.10.0

Type: Improvement Priority: Major - P3
Reporter: Jonathan Wang Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

all


Issue Links:
Related
related to CDRIVER-2402 Allow mongoc to be added as subproject Closed
is related to CDRIVER-1950 CMake build should use BUILD_SHARED_L... Closed
Epic Link: Remove Autotools

 Description   

The CMake build configuration currently does not allow using and installing the bundled BSON. This feature is available when using configure, so it should be available when using CMake as well.



 Comments   
Comment by Githook User [ 26/Jan/18 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-1948 build bundled libbson with cmake
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/1327ddf30532283bf1436a9297df5746add2f83e

Comment by A. Jesse Jiryu Davis [ 21/Dec/17 ]

Let's see if there's useful code in https://github.com/mongodb/mongo-c-driver/pull/465 to include in this work.

Comment by A. Jesse Jiryu Davis [ 10/Dec/16 ]

Great, thanks for the response.

Comment by Jonathan Wang [ 09/Dec/16 ]

Also, I noticed that CDRIVER-1944 has since been closed, so I can just pull the latest master commit, and therefore I no longer have a need to use the CMake build for the Mongo C driver.

Comment by Jonathan Wang [ 09/Dec/16 ]

This is important because due to CXX-1158, I'm currently experimenting with using CMake instead of configure to build the C driver against OpenSSL libraries at a specified location. However, the main obstacle to getting this to work is that I was previously using the --with-libbson=bundled flag for configure, but now there is no option to do so for CMake.

My goal for trying to do this is only to use the bundled BSON library instead of trying to install the BSON library from another source location, which may or may not lead to version/API conflicts.

However, you can lower the priority on this because I believe I have an acceptable workaround using a two-pass installation. First, I install the bundled BSON library by installing Mongo C driver with configure and with --with-libbson=bundled --disable-ssl. Then I remove the installed Mongo C driver components, only leaving behind the BSON C library. Then I install the Mongo C driver using CMake with the OpenSSL location provided using PKG_CONFIG_LIBDIR.

This achieves the two goals: use bundled BSON and link against a specific custom OpenSSL installation.

Comment by A. Jesse Jiryu Davis [ 09/Dec/16 ]

jwang can you tell us why this is important? If you've got a strong argument we can set the priority accordingly.

Comment by Hannes Magnusson [ 09/Dec/16 ]

In all honesty, the CMake build system is not a first-class citizen.. It was added so we could generate MSVC manifests. Since then minor additions have been made to it on case by case bases.

We did look into how to compile against the bundled libbson, but it turned out (very likely simply due to lack of understanding of cmake! ) to be more work then it was worth.

It seems unlikely to be fixed anytime soon unless we find someone capable in the arts of CMake to do it for us

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