function(enable_doxygen)
  find_package(Doxygen REQUIRED dot)
  if (DOXYGEN_FOUND)
    option(ENABLE_DOXYGEN "Enable doxygen doc builds of source" OFF)
    if(ENABLE_DOXYGEN)
      set(DOXYGEN_CALLER_GRAPH YES)
      set(DOXYGEN_CALL_GRAPH YES)
      set(DOXYGEN_EXTRACT_ALL YES)
      set(DOXYGEN_INPUT_DIRECTORY ${PROJECT_SOURCE_DIR})
      set(DOXYGEN_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/docs)
      set(DOXYGEN_GENERATE_HTML YES)
      set(DOXYGEN_HTML_OUTPUT ${PROJECT_SOURCE_DIR}/docs)
      set(DOXYGEN_GENERATE_LATEX NO)

      doxygen_add_docs(Doxygen "${PROJECT_SOURCE_DIR}" ALL COMMENT "Generating docs")

    endif()
  else()
    message(FATAL_ERROR "Doxygen need to be installed to generate the doxygen documentation")
  endif()
endfunction()
