1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
#
# Find doxygen
#
find_package(Doxygen)
if(NOT DOXYGEN_FOUND)
message(STATUS "Disabled generation of doxygen documentation (missing doxygen).")
return()
endif()
#
# Target name
#
set(target api-docs)
message(STATUS "Doc ${target}")
#
# Input file
#
set(doxyfile_in doxyfile.in)
#
# Create documentation
#
# Set project variables
set(doxyfile "${CMAKE_CURRENT_BINARY_DIR}/doxyfile")
set(doxyfile_directory "${CMAKE_CURRENT_BINARY_DIR}/html")
set(doxyfile_html "${doxyfile_directory}/index.html")
# Get filename and path of doxyfile
get_filename_component(name ${doxyfile_in} NAME)
get_filename_component(path ${doxyfile_in} PATH)
if(NOT path)
set(path ${CMAKE_CURRENT_SOURCE_DIR})
endif()
# Configure doxyfile (if it is a real doxyfile already, it should simply copy the file)
set(DOXYGEN_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
configure_file(${doxyfile_in} ${doxyfile})
# Invoke doxygen
add_custom_command(
OUTPUT ${doxyfile_html}
DEPENDS ${doxyfile} ${META_PROJECT_NAME}::globjects
WORKING_DIRECTORY ${path}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${path} ${doxyfile_directory} # ToDO, configure doxygen to use source as is
COMMAND ${DOXYGEN} \"${doxyfile}\"
COMMENT "Creating doxygen documentation."
)
# Declare target
add_custom_target(${target} ALL DEPENDS ${doxyfile_html})
add_dependencies(docs ${target})
#
# Deployment
#
install(
DIRECTORY ${doxyfile_directory}
DESTINATION ${INSTALL_DOC}
COMPONENT docs
)
|