-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
C Drivers
-
None
-
None
-
None
-
None
-
None
-
None
Summary
BUILD_SHARED_LIBS_WITH_STATIC_MONGOC applies to static targets under some conditions. This disagrees with the option name and description.
Furthermore, the pkg-config scripts unconditionally have the static C++ driver targets depend on the static C driver targets (regardless of BUILD_SHARED_LIBS_WITH_STATIC_MONGOC).
To reproduce
Configuring with BUILD_SHARED_LIBS_WITH_STATIC_MONGOC=OFF:
cmake \ -DBUILD_SHARED_AND_STATIC_LIBS=ON \ -DBUILD_SHARED_LIBS_WITH_STATIC_MONGOC=OFF \ -DCMAKE_INSTALL_PREFIX=.install1 \ -S. -Bcmake-build1 cmake --build cmake-build1 --target install --parallel
Results in an installed bsoncxx_targets.cmake with:
set_target_properties(mongo::bsoncxx_static PROPERTIES
# [ ... ]
INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:bson::shared>"
)
And configuring with BUILD_SHARED_LIBS_WITH_STATIC_MONGOC=ON:
cmake \ -DBUILD_SHARED_AND_STATIC_LIBS=ON \ -DBUILD_SHARED_LIBS_WITH_STATIC_MONGOC=ON \ -DCMAKE_INSTALL_PREFIX=.install2 \ -S. -Bcmake-build2 cmake --build cmake-build2 --target install --parallel
Results in an installed bsoncxx_targets.cmake with:
set_target_properties(mongo::bsoncxx_static PROPERTIES
# [ ... ]
INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:bson::static>"
)
Details
- BUILD_SHARED_LIBS_WITH_STATIC_MONGOC=OFF is the default.
- If BUILD_SHARED=OFF, then BUILD_SHARED_LIBS_WITH_STATIC_MONGOC is ignored, and static C++ driver targets use static C targets.
- This is further complicated by differences in the pkg-config scripts. The static C++ driver pkg-config targets always depend on the static C driver targets (regardless of BUILD_SHARED_LIBS_WITH_STATIC_MONGOC). This was noticed after an accidental change (static => shared) restored in CXX-3290.