set(MATH_DOXYGEN_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(MATH_DOXYGEN_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
set(MATH_DOXYGEN_DOXYFILE_IN "${MATH_DOXYGEN_SOURCE_DIR}/Doxyfile.in")
set(MATH_DOXYGEN_DOXYFILE "${MATH_DOXYGEN_BINARY_DIR}/Doxyfile")

find_package(Doxygen)
if(NOT DOXYGEN_FOUND)
	message(FATAL_ERROR "Doxygen not found. Required to build documentation.")
endif()

configure_file(${MATH_DOXYGEN_DOXYFILE_IN} ${MATH_DOXYGEN_DOXYFILE} @ONLY)

add_custom_target(doc ALL ${DOXYGEN_EXECUTABLE} ${MATH_DOXYGEN_DOXYFILE}
	WORKING_DIRECTORY ${MATH_DOXYGEN_BINARY_DIR}
	COMMENT "Generating HTML documentation" VERBATIM)

set(MATH_DOXYGEN_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(MATH_DOXYGEN_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
set(MATH_DOXYGEN_DOXYFILE_IN "${MATH_DOXYGEN_SOURCE_DIR}/Doxyfile.in")
set(MATH_DOXYGEN_DOXYFILE "${MATH_DOXYGEN_BINARY_DIR}/Doxyfile")

find_package(Doxygen)
if(NOT DOXYGEN_FOUND)
	message(FATAL_ERROR "Doxygen not found. Required to build documentation.")
endif()

configure_file(${MATH_DOXYGEN_DOXYFILE_IN} ${MATH_DOXYGEN_DOXYFILE} @ONLY)

add_custom_target(doc ${DOXYGEN_EXECUTABLE} ${MATH_DOXYGEN_DOXYFILE}
	WORKING_DIRECTORY ${MATH_DOXYGEN_BINARY_DIR}
	COMMENT "Generating HTML documentation" VERBATIM)

Remove documentation from ALL target.
Remove documentation from ALL target.
