我正在尝试构建mongo-cxx-driver (最终),第一步是构建mongo-c-driver (需要libbson)。
我运行的是Windows 10,并且使用Visual Studio 2015作为我的编译器。我能够很好地运行CMake并构建libbson,所有构建的项目都很好。现在,我在mongo-c-driver/src/libbson/build/Debug/和mongo-c-driver/src/libbson/build/Release/中构建了bson-static-1.0.lib的副本。这看起来一切都是正确的。
下一步是构建mongo-c-driver。我运行CMake并尝试创建Visual Studio解决方案,但得到了错误:
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_LIBRARIES OPENSSL_INCLUDE_DIR)
Searching for sasl/sasl.h
Not found (specify -DCMAKE_INCLUDE_PATH=C:/path/to/sasl/include for SASL support)
Searching for libsasl2
Not found (specify -DCMAKE_LIBRARY_PATH=C:/path/to/sasl/lib for SASL support)
Current version (from VERSION_CURRENT file): 1.3.5
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
BSON (ADVANCED)
linked by target "mongoc_shared" in directory C:/Users/sdf/Downloads/mongo-c-driver-1.3.5
linked by target "mongoc_static" in directory C:/Users/sdf/Downloads/mongo-c-driver-1.3.5
Configuring incomplete, errors occurred!
See also "C:/Users/sdf/Downloads/mongo-c-driver-1.3.5/build/CMakeFiles/CMakeOutput.log".看起来变量BSON没有设置正确的值--它的值现在是BSON-NOTFOUND。有没有人知道BSON的正确值是什么,以及它是否应该在编译libbson的过程中自动设置
发布于 2017-10-28 03:04:16
编译MongoDB c++ driver.use vcpkg的智能方法
按照git上提到的说明下载vcpkg。https://github.com/Microsoft/vcpkg
Step 1 C:\vcpkg>.\vcpkg搜索mongodb
步骤2 C:.\vcpkg搜索mongodb安装mongo-cxx-driver
STAP3 C:\vcpkg>.\vcpkg集成安装
发布于 2016-07-30 02:40:13
请仔细按照“在Windows上安装”的说明操作:
https://api.mongodb.com/c/current/installing.html#building-windows
您似乎遗漏了在构建libbson时设置CMAKE_INSTALL_PREFIX的部分,然后安装libbson并使用相同的CMAKE_INSTALL_PREFIX设置构建libmongoc。
发布于 2017-02-16 16:30:04
首先,您需要在libbson sln中构建安装项目(在管理模式下运行vs,因为它需要像linux那样创建lib文件夹)
然后定义BSON_INCLUDE_DIR以包含安装项目创建的文件夹和您构建的库文件,例如C:/Program Files/libbson/ lib / BSON -static-1.0.lib in cmake (此BSON命名有问题,应重命名为BSON_LIB)
https://stackoverflow.com/questions/38644960
复制相似问题