简体   繁体   中英

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/

I have already build mongodb c driver as well as libbson 1.0 as per the instructions mentioned in the above link.

I got stuck at Step 4: Configure driver. 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.

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

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 " .

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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