Из вашего вопроса немного неясно, что делает ваш код.Ниже я приведу пример того, как создать пример кода.vcpkg - менеджер пакетов, а cmake - инструмент сборки.
Настройка vcpkg в командной строке:
cd vcpkg
bootstrap-vcpkg.bat
vcpkg install mongo-cxx-driver
Настройка проекта Visual Studio
Добавить исходный код

#include <cstdint>
#include <iostream>
#include <vector>
#include <bsoncxx/json.hpp>
#include <mongocxx/client.hpp>
#include <mongocxx/stdx.hpp>
#include <mongocxx/uri.hpp>
using bsoncxx::builder::stream::close_array;
using bsoncxx::builder::stream::close_document;
using bsoncxx::builder::stream::document;
using bsoncxx::builder::stream::finalize;
using bsoncxx::builder::stream::open_array;
using bsoncxx::builder::stream::open_document;
int main() {
mongocxx::client mongo_client{ mongocxx::uri{"mongodb://localhost:27017"} };
return 0;
}




Построение решения
1>------ Build started: Project: mongodb, Configuration: Debug Win32 ------
1>Source.cpp
1>mongodb.vcxproj -> D:\dev\cpptest\mongodb\Debug\mongodb.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Для запуска .exe вам нужно добавить в путь D: \ dev \ GitHub \ vcpkg \ instal \ x86-windows \ bin.Это так, что .exe может найти mongocxx.dll
