IF(DOXYGEN_FOUND)

	IF(APPLE)
		OPTION(DOCS_GENERATE_DOCSET "Generate Apple Docsets." OFF)
	ENDIF()

	SET(DOT_FOUND "NO")
	IF(DOXYGEN_DOT_FOUND)
		SET(DOT_FOUND "YES")
	ENDIF()

	ADD_CUSTOM_TARGET(doc ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
		WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
		COMMENT "Generating source code documentation with Doxygen." VERBATIM)

	SET(DOCS_GENERATE_TREEVIEW_STRING "YES" CACHE INTERNAL "")
	SET(DOCS_DISABLE_INDEX_STRING "NO" CACHE INTERNAL "")
	IF(DOCS_GENERATE_DOCSET)
		SET(DOCS_GENERATE_TREEVIEW_STRING "NO" CACHE INTERNAL "" FORCE)
		SET(DOCS_DISABLE_INDEX_STRING "YES" CACHE INTERNAL "" FORCE)
		SET(DOCS_GENERATE_DOCSET_STRING "YES" CACHE INTERNAL "")
		ADD_CUSTOM_COMMAND(TARGET doc POST_BUILD
			COMMAND make WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/docs
			COMMENT "Generating docset ...")
	ENDIF() # DOCS_GENERATE_DOCSET

	CONFIGURE_FILE(scripts/docs/Doxyfile.in ${PROJECT_BINARY_DIR}/Doxyfile)

ENDIF() # DOXYGEN_FOUND
