[CXX-1707] Export targets for CMake project Created: 27/Dec/18  Updated: 28/Oct/23  Resolved: 23/Sep/19

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

Type: Improvement Priority: Minor - P4
Reporter: Amit Ambasta Assignee: Roberto Sanchez
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Cloners
is cloned by CDRIVER-3047 Export targets for CMake project Closed
Related
related to MONGOCRYPT-140 Update kms_message exported CMake tar... Closed

 Description   

Hi,

 

Currently mongocxx build directory exposes LIBMONGOCXX_INCLUDE_DIRS and LIBMONGOCXX_LIBRARIES in its config.cmake which projects depending on libmongocxx can use.

It would instead be preferable to additionally export targets so that other projects can use libmongocxx (and by extension libbson and libmongoc) as subprojects in their own projects. It is additionally, the recommended way for projects to link to third party projects and avoids having to specify both INCLUDE and LINK dir separately.



 Comments   
Comment by Githook User [ 27/Dec/19 ]

Author:

{'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}

Message: CXX-1901 check for old libbson cmake pkg name

CDRIVER-3047 added new cmake package names for the C driver
(bson-1.0/mongoc-1.0) and deprecated the old ones (libbson-1.0/
libmongoc-1.0 and libbson-static-1.0/libmongoc-static-1.0).

CXX-1707 changed the C++ driver to use the new names of the
C driver. That implicitly requires the latest C driver to build
against. So, this change fall backs to the old package names
if the new ones are not found.
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/bd49ba3a725ce877ca9037728ba362fdfd660dd9

Comment by Githook User [ 23/Sep/19 ]

Author:

{'username': 'rcsanchez97', 'email': 'roberto@connexer.com', 'name': 'Roberto C. Sánchez'}

Message: CXX-1707 export CMake targets
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/54f2d69374bc45f8d17eb5dda1ca5576e678f1fc

Comment by Ian Whalen (Inactive) [ 24/Jun/19 ]

same as C work for targets - "scheduled" to put below libmongocrypt.

Comment by Roberto Sanchez [ 02/Apr/19 ]

Here is a summary of what remains for this task:

  • Replace the standard .cmake.in configuration template with a one-liner file containing a simple include directive (this is what is done in kms_message-config.cmake)
  • Mark the exportable targets in CMakeLists.txt
  • Tell CMake to actually install the exported targets (which creates and installs the file referenced by, e.g., kms_message-config.cmake), using the namespace 'mongo::'
  • Consider updating consumers to use the simpler mechanism made available by the exported targets
Comment by Kevin Albertson [ 25/Feb/19 ]

Hi amit.ambasta@delhivery.com,

Apologies for the delay. We haven't forgotten about this and we'll come back to this after some higher priority work on the C driver.

Generated at Wed Feb 07 22:03:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.