message("")
message(STATUS "${BoldGreen}Starting developer 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")

# 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(debugdoc
  COMMAND /usr/lib/qt6/bin/qdoc --debug 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")

message("The devdoc images and html directories will be installed in
${CMAKE_INSTALL_DOCDIR}")

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

add_custom_target(devdoc
  DEPENDS doc)

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