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.
- is depended on by
-
CDRIVER-1993 cmake doesn't check libbson minimum version
- Closed
- related to
-
CXX-1158 Unable to link against SSL libs on MacOS
- Closed