-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: cmake
-
None
The cause of CDRIVER-3493 was having an explicit dependency on the mongo::mongocrypt target, but not having a call to find_dependency (mongocrypt) in mongoc-config.cmake. Currently, there's no great way to express such a dependency for consumers.
mongoc-config.cmake is used for both static and shared targets (mongo::mongoc_shared and mongo::mongoc_static). But a dependency like that only needs to be exposed in the static target (since the shared target has already linked against libmongocrypt.so, and that location information is part of the library itself).
So, adding a call to find_dependency in mongoc-config.cmake adds the dependency for both targets, even though we only need it for the static target. The workaround of CDRIVER-3493 was to not depend on the cmake target, and rather depend on the library explicitly (pulling that information out of the mongo::mongocrypt target) as an INTERFACE_LINK_LIBRARY.