FIND_PACKAGE(Doxygen)
IF (DOXYGEN_FOUND)
    if (DOXYGEN_DOT_EXECUTABLE)
        SET(DOXYGEN_DOT_FOUND YES)
    ELSE(DOXYGEN_DOT_EXECUTABLE)
        SET(DOXYGEN_DOT_FOUND NO)
        SET(DOXYGEN_DOT_EXECUTABLE "")
    ENDIF(DOXYGEN_DOT_EXECUTABLE)
    CONFIGURE_FILE(Doxyfile.in Doxyfile @ONLY)
    ADD_CUSTOM_TARGET(doc doxygen Doxyfile)

    file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html)
    install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html/ DESTINATION
        share/doc/${PROJECT_NAME}/html)
ENDIF(DOXYGEN_FOUND)

