message("")
message(STATUS "${BoldGreen}Starting configuration for the doc material for ${CMAKE_PROJECT_NAME} ${ColourReset}")
message("")

# The UNIX man pages
if(UNIX AND NOT APPLE)

	message(STATUS "Going to generate the man pages.")

	execute_process(COMMAND docbook-to-man ${CMAKE_PROJECT_NAME}.xml
		OUTPUT_FILE	${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.1
		WORKING_DIRECTORY	${CMAKE_CURRENT_SOURCE_DIR})
	execute_process(COMMAND docbook-to-man tandemwrapper.xml
		OUTPUT_FILE	${CMAKE_BINARY_DIR}/tandemwrapper.1
		WORKING_DIRECTORY	${CMAKE_CURRENT_SOURCE_DIR})
		
	execute_process(COMMAND docbook-to-man mzxmlconverter.xml
		OUTPUT_FILE	${CMAKE_BINARY_DIR}/mzxmlconverter.1
		WORKING_DIRECTORY	${CMAKE_CURRENT_SOURCE_DIR})

endif(UNIX AND NOT APPLE)


###############
# install stuff

# The history and licence files.

message("Installing the doc files in ${DOC_DIR}")

# The man page.
if(UNIX AND NOT APPLE)
	install(FILES ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.1
		${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.1
		DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1)
    install(FILES ${CMAKE_BINARY_DIR}/tandemwrapper.1
		${CMAKE_BINARY_DIR}/tandemwrapper.1
		DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1)
    install(FILES ${CMAKE_BINARY_DIR}/mzxmlconverter.1
		${CMAKE_BINARY_DIR}/mzxmlconverter.1
		DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1)
endif()


#############################################################
###########################
# BUILD OF THE USER MANUALS

if(BUILD_USER_MANUAL)
	add_subdirectory(user-manual)
endif()


if(USE_TYPST)
	add_subdirectory(typst)
endif(USE_TYPST)

message("")
message(STATUS "${BoldGreen}Finished configuration of the doc material.${ColourReset}")
message("")

