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.
-
Download boost c++ 1.70 libraries and unzip to "C:/boost_1_70_0"
-
Create a build folder:
mkdir build && cd build
- Generate project configuration files for Windows 64
cmake -G "Visual Studio 15 2017 Win64" .. # "-DCMAKE_BUILD_TYPE=Release"
- Build MongoDB C++ drivers:
cmake --build . # --config Release
After successfully build drivers will be in a drivers directory!
- Additional, build and install test program executes:
cmake --build . --target install
- Run the test program:
../install/test_mongocxx.exe
- http://mongocxx.org/mongocxx-v3/installation/
- http://mongoc.org/libmongoc/current/installing.html
- https://stackoverflow.com/questions/51717207/building-mongo-cxx-driver-using-cmake-externalproject-add
- https://github.com/dhandeo/cmake-mongo-cxx-driver
- https://cliutils.gitlab.io/modern-cmake/chapters/basics.html
- https://stackoverflow.com/questions/39598323/how-to-properly-link-libraries-with-cmake
- https://hackernoon.com/create-a-mongodb-sharded-cluster-with-ssl-enabled-dace56bc7a17
- https://medium.com/@rajanmaharjan/secure-your-mongodb-connections-ssl-tls-92e2addb3c89