Hello, I am still new to CMake and try to use the mongoc driver. I don’t want to use install feature, I just wish to have my dependencies as git submodules in my main git repository.
This is my folder hierarchy with two dependencies submodules, poco and mongoc.
Then in my top CMake file I add this:
...... add_subdirectory(ThirdParties/poco) add_subdirectory(ThirdParties/mongo-c-driver) ...... target_link_libraries(tests PUBLIC Poco::Foundation) target_link_libraries(tests PUBLIC mongo::mongoc_shared) ......
For the last line which links with library mongo_shared, I just copied what I found in the hello_mongo example.
For some reason I’ve not grasped yet, when doing this, I get the following error:
CMake Error at CMakeLists.txt:12 (target_link_libraries): Target "tests" links to: mongo::mongoc_shared but the target was not found. Possible reasons include: * There is a typo in the target name. * A find_package call is missing for an IMPORTED target. * An ALIAS target is missing.
To fix this, I need to replace “mongo::mongoc_shared” with just “mongoc_shared”, thus removing the namespace mongo, when the same works for namespace Poco.
What did I miss there?