简体   繁体   English

CMake 错误在 src/bsoncxx/CMakeLists.txt - Mongodb Cxx 驱动程序

[英]CMake Error at src/bsoncxx/CMakeLists.txt - Mongodb Cxx Driver

I have followed the steps in order to build mongodb cxx driver from the below link http://mongocxx.org/mongocxx-v3/installation/我已按照以下步骤从以下链接构建 mongodb cxx 驱动程序http://mongocxx.org/mongocxx-v3/installation/

I have already build mongodb c driver as well as libbson 1.0 as per the instructions mentioned in the above link.我已经按照上面链接中提到的说明构建了 mongodb c 驱动程序以及 libbson 1.0。

I got stuck at Step 4: Configure driver.我被困在第 4 步:配置驱动程序。 I downloaded mongodb cxx driver and nagivated to build folder and if i try to run the commands given in the above link (step 4 on Windows 10) i get the following error.我下载了 mongodb cxx 驱动程序并导航到构建文件夹,如果我尝试运行上述链接中给出的命令(Windows 10 上的第 4 步),我会收到以下错误。

CMake Error at src/bsoncxx/CMakeLists.txt:98 (find_package):
  By not providing "Findlibbson-1.0.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "libbson-1.0", but CMake did not find one.

  Could not find a package configuration file provided by "libbson-1.0"
  (requested version 1.13.0) with any of the following names:

    libbson-1.0Config.cmake
    libbson-1.0-config.cmake

  Add the installation prefix of "libbson-1.0" to CMAKE_PREFIX_PATH or set
  "libbson-1.0_DIR" to a directory containing one of the above files.  If
  "libbson-1.0" provides a separate development package or SDK, be sure it
  has been installed.

The command which i tried to run is as below我试图运行的命令如下

'C:\Program Files\CMake\bin\cmake.exe' .. \
    -G "Visual Studio 16 2019"            \
    -DCMAKE_CXX_STANDARD=17                     \
    -DCMAKE_CXX_FLAGS="/Zc:__cplusplus"         \
    -DBOOST_ROOT=C:\local\boost_1_59_0          \
    -DCMAKE_PREFIX_PATH=C:\mongo-c-driver       \
    -DCMAKE_INSTALL_PREFIX=C:\mongo-cxx-driver

Note.: I have mongo c driver at C:\mongo-c-drive and libbson C:\libbson注意:我在 C:\mongo-c-drive 和 libbson C:\libbson 有 mongo c 驱动程序

Help me to fix the above.帮我解决上述问题。

You are missing this part of the instructions:您缺少这部分说明:

-DCMAKE_PREFIX_PATH=/opt/mongo-c-driver         \

My error was simply not surrounding the commands with " .我的错误只是没有用"包围命令。

So if somebode has the same error and has compiled the C driver correctly, make sure to sorround the props with " .所以如果有人有同样的错误并且已经正确编译了 C 驱动程序,请确保用"围绕道具。

eg:例如:

'C:\Program Files\CMake\bin\cmake.exe' .. \
    -G "Visual Studio 16 2019"            \
    "-DCMAKE_CXX_STANDARD=17"                     \
    -DCMAKE_CXX_FLAGS="/Zc:__cplusplus"           \
    "-DBOOST_ROOT=C:\local\boost_1_59_0"          \
    "-DCMAKE_PREFIX_PATH=C:\mongo-c-driver"       \
    "-DCMAKE_INSTALL_PREFIX=C:\mongo-cxx-driver"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM