mongo-c-driver provides CMake targets:
find_package(mongoc CONFIG REQUIRED)
target_link_libraries(main PRIVATE mongoc::mongoc)