/building-mongo-cxx-driver-using-cmake

An example of how to compile MongoDB cxx driver using CMake.

Primary LanguageCMakeMIT LicenseMIT

Building mongo cxx driver using cmake

An example of how to compile a shared MongoDB cxx driver using CMake. Currently, the solution is only for Windows. After successful build drivers will be available in a drivers directory and mini-test program for driver testing in an install directory.

Steps how to build drivers and test it

  1. Download boost c++ 1.70 libraries and unzip to "C:/boost_1_70_0"

  2. Create a build folder:

mkdir build && cd build
  1. Generate project configuration files for Windows 64
cmake -G "Visual Studio 15 2017 Win64" .. # "-DCMAKE_BUILD_TYPE=Release" 
  1. Build MongoDB C++ drivers:
cmake --build . # --config Release

After successfully build drivers will be in a drivers directory!

  1. Additional, build and install test program executes:
cmake --build . --target install
  1. Run the test program:
../install/test_mongocxx.exe

Source