BUILD_SHARED_LIBS_WITH_STATIC_MONGOC applies to static targets

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • C Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • 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.

            Assignee:
            Unassigned
            Reporter:
            Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: