使用MinGW和MSYS2构建MongoDB C ++驱动程序

时间:2017-05-03 08:29:07

标签: c++ windows mongodb mingw msys

尝试使用MSYS2中的MinGW为自己的项目构建MongoDB C ++驱动程序。 我成功地建立了libbsonMongoDB C driver。之后,使用下一个命令为MinGW创建了构建项目:

$ cmake -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=d:/build/mongo-cxx-driver -DLIBBSON_DIR=d:/build/mongo-c-driver -DLIBMONGOC_DIR=d:/build/mongo-c-driver -DBSONCXX_POLY_USE_BOOST=1 ..
$ mingw32-make install

之后,该构建在82%失败:

[ 82%] Building CXX object src/mongocxx/test/CMakeFiles/test_driver.dir/collection_mocked.cpp.obj
... (a lot of warnings)
D:/tools/mongo-cxx-driver/src/third_party/catch/include/catch.hpp:823:34: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
             return opCast( lhs ) ==  opCast( rhs );
                    ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~

mingw32-make[2]: *** [src\mongocxx\test\CMakeFiles\test_driver.dir\build.make:188: src/mongocxx/test/CMakeFiles/test_driver.dir/collection_mocked.cpp.obj] Error 1

第三方软件中发生错误。我该如何避免这个问题?是否有可能不为mongodb构建测试?

更新:

通过在add_subdirectory(test)mongo-cxx-driver\src\bsoncxx\CMakeLists.txt中评论mongo-cxx-driver\src\mongocxx\CMakeLists.txt行来解决此问题。这将删除测试要求,catch源将被忽略。

0 个答案:

没有答案