Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-1058

Install CMake 'config' style files for find_package

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.7.0
    • Affects Version/s: None
    • Component/s: Build
    • Labels:
      None

      In order to use libbson and libmongo-c easily within CMake projects, you need to find them somehow.

      The easiest way to do this is to use the CMake pkg_check_modules (https://cmake.org/cmake/help/v3.1/module/FindPkgConfig.html) functionality, and that works just fine on platforms that support pkg-config.

      However, not all platforms commonly use pkg-config, notably windows.

      On Windows, it is much more likely that packages will be found via a project local 'module' for libbson and libmongoc. That module will in turn use find_package (https://cmake.org/cmake/help/v3.0/command/find_package.html) to look for an installed .cmake file for each of libbson and libmongoc.

      Typically, those files would be generated as part of the libbson and libmongoc build process. See https://cmake.org/cmake/help/v3.0/module/CMakePackageConfigHelpers.html for details on what is expected in those files. As noted on that page, a project built with CMake can use some helpers to generate its config-mode package definition .cmake files

      It is unclear whether those files need to be generated from an autoconf build of libbson and libmongoc. Any system where autoconf runs almost certainly has pkg-config. So, maybe libmongoc and libbson can simplify things and only generate and install the config-mode package definition files from the CMake build.

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: