I am on Ubuntu 18.04, have installed the MongoCXX driver to location: /usr/local/
I have tried the following test script using the command line argument given in the tutorial, and it works fine
c++ --std=c++11 test.cpp -o test $(pkg-config --cflags --libs libmongocxx)
However i cannot seem to get it to work with CMAKE. I am fairly new to CMAKE, and must be doing something stupid, but cant figure out what.
Below is my CMAKE file:
cmake_minimum_required(VERSION 3.5)
project(testThread)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wall -Werror -std=c++14")
set(source_dir "${PROJECT_SOURCE_DIR}/src/")
file(GLOB source_files "${source_dir}/*.cpp")
set(CMAKE_PREFIX_PATH "/usr/local")
find_package(mongocxx CONFIG REQUIRED)
add_executable (testThread ${source_files})
The CMAKE file builds successfully, which indicates that CMAKE has found the package, but it when i compile my program, it fails with the following error:
“fatal errror: bsoncxx/builder/stream/document.hpp: No such file or directory”
Does anyone have any idea why this is happening, or what i can do to debug this problem?
Any help would be greatly appreciated