libbson provides CMake targets: find_package(bson CONFIG REQUIRED) target_link_libraries(main PRIVATE $,bson::static,bson::shared>)