if(BUILD_USER_MANUAL)

  if(UNIX)

    message("")
    message(STATUS "${BoldGreen}Starting configuration for the user manual for ${CMAKE_PROJECT_NAME} ${ColourReset}")
    message("")

    # The version of the program needs to be set in the user manual front
    # matter.
    configure_file(${CMAKE_SOURCE_DIR}/CMakeStuff/user-manual-version-entity.ent.cmake.in
      ${CMAKE_SOURCE_DIR}/doc/user-manual/xml/user-manual-version-entity.ent @ONLY)

    # The file driving the user manual build is DC-user-manual.
    # This file contains a config bit that points to the directory
    # that contains de fop.xconf configuration file needed by
    # the FOP utility that crafts the user manual pdf file.

    set(FOP_XCONF_DIR ${CMAKE_SOURCE_DIR}/doc/user-manual)
    configure_file(${CMAKE_SOURCE_DIR}/CMakeStuff/DC-user-manual.cmake.in
      ${CMAKE_SOURCE_DIR}/doc/user-manual/DC-user-manual @ONLY)

    message("\tConfiguring the user manual compilation")

    # The output of Daps will be in BUILD_DIR.
    add_custom_target(user-manual
      COMMAND make BUILD_DIR=${CMAKE_BINARY_DIR}/doc -f usermanual-makefile all_f
      COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/doc/user-manual/html ${CMAKE_SOURCE_DIR}/doc/user-manual/html
      WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/doc/user-manual
      COMMENT "Build of the DocBook-based user manual \
      documentation in ${CMAKE_BINARY_DIR}/doc")

    install(FILES
      ${CMAKE_BINARY_DIR}/doc/user-manual/${TARGET}-doc.pdf
      DESTINATION ${DOC_DIR})

    install(DIRECTORY
      ${CMAKE_BINARY_DIR}/doc/user-manual/html/user-manual/
      DESTINATION ${DOC_DIR}/html)

    message("")
    message(STATUS "${BoldGreen}Finished configuring the ${CMAKE_PROJECT_NAME} user manual.${ColourReset}")
    message("")

  else()

    message(STATUS "User manual build skipped")

  endif()

endif()
