message("")
message(STATUS "${BoldGreen}Starting documentation build configuration for \
${CMAKE_PROJECT_NAME} ${ColourReset}")
message("")

# The output of QDoc will be in ${CMAKE_BINARY_DIR}/html.
# We need to copy the images directory to the build directory.
add_custom_target(doc
  COMMAND /usr/lib/qt6/bin/qdoc developer-documentation.qdocconf --outputdir
${CMAKE_CURRENT_BINARY_DIR}/html
	COMMAND cp -rpf ${CMAKE_CURRENT_LIST_DIR}/images ${CMAKE_CURRENT_BINARY_DIR}/
  WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
  COMMENT "Build of the QDoc-based developer documentation in ${CMAKE_CURRENT_BINARY_DIR}/html")

# For convenience
add_custom_target(documentation DEPENDS doc)

install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/images
  DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html
  DESTINATION ${CMAKE_INSTALL_DOCDIR})

message("")
message(STATUS "${BoldGreen}Finished configuring the ${CMAKE_PROJECT_NAME}  \
developer documentation.${ColourReset}")
message("")
