1

Trying to build mongocxx driver. I have installed mongoc driver without problems in path c:\mongo-c-driver (ver. 1.14.0). After running:

cmake.exe -G "Visual Studio 15 2017 Win64"
    -DCMAKE_INSTALL_PREFIX=C:\mongo-cxx-driver
    -DCMAKE_PREFIX_PATH=C:\mongo-c-driver
    -DCMAKE_CXX_STANDARD=17
    -DCMAKE_CXX_FLAGS="/Zc:__cplusplus"

got an error enter image description here

Don't know why but in in file libbson-1.0-config.cmake I have lines like:

set (BSON_MAJOR_VERSION 0)
set (BSON_MINOR_VERSION 0)
set (BSON_MICRO_VERSION 0)
set (BSON_VERSION 0.0.0)

and in libbson-1.0-config-version.cmake:

set (PACKAGE_VERSION 0.0.0)

I Think that here's possible reason but changing these lines manually doesn't fix the problem (try with 3.2 and 3.4 version of mongocxx driver).

KonDziupla
  • 23
  • 3
  • I believe this is due to an issue in how you have built the C driver. You need to provide some metadata to ensure it knows its version. I've pinged the internal team that maintains the C driver with a link to this question, since I don't know exactly how to fix it. – acm Mar 21 '19 at 16:36

2 Answers2

0

Please see https://jira.mongodb.org/browse/CDRIVER-3022 for instructions on how to avoid this issue. The TL;DR is that the zip file that GitHub automatically produces for a release doesn't contain required version information.

acm
  • 12,183
  • 5
  • 39
  • 68
  • 1
    Thanks a lot! Works with 1.13.1 version that contains VERSION_CURRENT and VERSION_RELEASED - both statically contain the string 1.13.1. and version 1.14.0 does not contain those files. – KonDziupla Mar 25 '19 at 13:39
0

Here's an official MongoDB article that showcases how to build and run mongocxx (MongoDB C++ Driver) on Windows - Getting Started with MongoDB and C++

rish2050
  • 1
  • 1