FIND_PATH(BSON_INCLUDE_DIR bson.h
        /usr/local/include/libbson-1.0
        /usr/include/libbson-1.0
        )

SET(BSON_NAMES ${BSON_NAMES} bson-1.0)
FIND_LIBRARY(BSON_LIBRARY
        NAMES ${BSON_NAMES}
        PATHS /usr/lib /usr/local/lib
        )

IF (BSON_LIBRARY AND BSON_INCLUDE_DIR)
    SET(BSON_LIBRARIES ${BSON_LIBRARY})
    SET(BSON_FOUND "YES")
ELSE (BSON_LIBRARY AND BSON_INCLUDE_DIR)
    SET(APR_FOUND "NO")
ENDIF (BSON_LIBRARY AND BSON_INCLUDE_DIR)


IF (BSON_FOUND)
    IF (NOT BSON_FIND_QUIETLY)
        MESSAGE(STATUS "Found BSON: ${BSON_LIBRARIES}")
    ENDIF (NOT BSON_FIND_QUIETLY)
ELSE (BSON_FOUND)
    IF (BSON_FIND_REQUIRED)
        MESSAGE(FATAL_ERROR "Could not find BSON library")
    ENDIF (BSON_FIND_REQUIRED)
ENDIF (BSON_FOUND)
