| 1 |
if(ENABLE_DOCS) |
| 2 |
add_custom_target(docs ALL |
| 3 |
COMMENT "Generating documentation and manuals in HTML format" |
| 4 |
) |
| 5 |
|
| 6 |
if(DOXYGEN_FOUND) |
| 7 |
# set input and output files |
| 8 |
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in) |
| 9 |
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) |
| 10 |
|
| 11 |
# configure for graphviz |
| 12 |
set(DOXYGEN_DIAGRAM "NO") |
| 13 |
if(DOXYGEN_DOT_FOUND) |
| 14 |
set(DOXYGEN_DIAGRAM "YES") |
| 15 |
endif() |
| 16 |
|
| 17 |
# request to configure the file |
| 18 |
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) |
| 19 |
|
| 20 |
# note the option ALL which allows to build the docs together with the application |
| 21 |
add_custom_command( |
| 22 |
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html" |
| 23 |
DEPENDS ${DOXYGEN_OUT} |
| 24 |
COMMAND "${DOXYGEN_EXECUTABLE}" "${DOXYGEN_OUT}" |
| 25 |
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" |
| 26 |
COMMENT "Generating API documentation with Doxygen" |
| 27 |
) |
| 28 |
add_custom_target( |
| 29 |
doxygen_docs |
| 30 |
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html" |
| 31 |
) |
| 32 |
add_dependencies(docs doxygen_docs) |
| 33 |
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html" |
| 34 |
DESTINATION "${CMAKE_INSTALL_DOCDIR}" |
| 35 |
) |
| 36 |
endif() |
| 37 |
|
| 38 |
if(ASCIIDOC_EXECUTABLE) |
| 39 |
add_custom_command( |
| 40 |
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/manual/manual.html" |
| 41 |
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/manual/manual.adoc" "${CMAKE_CURRENT_SOURCE_DIR}/manual/images" |
| 42 |
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/manual" |
| 43 |
COMMAND "${ASCIIDOC_EXECUTABLE}" -b html5 -o "${CMAKE_CURRENT_BINARY_DIR}/manual/manual.html" "${CMAKE_CURRENT_SOURCE_DIR}/manual/manual.adoc" |
| 44 |
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/manual/images" "${CMAKE_CURRENT_BINARY_DIR}/manual/images" |
| 45 |
COMMENT "Generating OpenSCAP User Manual in HTML format" |
| 46 |
) |
| 47 |
add_custom_target( |
| 48 |
user_manual |
| 49 |
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/manual/manual.html" |
| 50 |
) |
| 51 |
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/manual" |
| 52 |
DESTINATION "${CMAKE_INSTALL_DOCDIR}" |
| 53 |
) |
| 54 |
|
| 55 |
add_custom_command( |
| 56 |
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/developer/developer.html" |
| 57 |
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/developer/developer.adoc" |
| 58 |
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/developer" |
| 59 |
COMMAND "${ASCIIDOC_EXECUTABLE}" -b html5 -o "${CMAKE_CURRENT_BINARY_DIR}/developer/developer.html" "${CMAKE_CURRENT_SOURCE_DIR}/developer/developer.adoc" |
| 60 |
COMMENT "Generating OpenSCAP Developer Manual in HTML format" |
| 61 |
) |
| 62 |
add_custom_target( |
| 63 |
developer_manual |
| 64 |
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/developer/developer.html" |
| 65 |
) |
| 66 |
# We are not installing the OpenSCAP Developer manual because it does not |
| 67 |
# make any sense to install this for end-users. |
| 68 |
|
| 69 |
add_custom_command( |
| 70 |
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/contribute/contribute.html" "${CMAKE_CURRENT_BINARY_DIR}/contribute/testing.html" "${CMAKE_CURRENT_BINARY_DIR}/contribute/versioning.html" |
| 71 |
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/contribute/contribute.adoc" "${CMAKE_CURRENT_SOURCE_DIR}/contribute/testing.adoc" "${CMAKE_CURRENT_SOURCE_DIR}/contribute/versioning.adoc" |
| 72 |
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/contribute" |
| 73 |
COMMAND "${ASCIIDOC_EXECUTABLE}" -b html5 -o "${CMAKE_CURRENT_BINARY_DIR}/contribute/contribute.html" "${CMAKE_CURRENT_SOURCE_DIR}/contribute/contribute.adoc" |
| 74 |
COMMAND "${ASCIIDOC_EXECUTABLE}" -b html5 -o "${CMAKE_CURRENT_BINARY_DIR}/contribute/testing.html" "${CMAKE_CURRENT_SOURCE_DIR}/contribute/testing.adoc" |
| 75 |
COMMAND "${ASCIIDOC_EXECUTABLE}" -b html5 -o "${CMAKE_CURRENT_BINARY_DIR}/contribute/versioning.html" "${CMAKE_CURRENT_SOURCE_DIR}/contribute/versioning.adoc" |
| 76 |
COMMENT "Generating contribute documentation in HTML format" |
| 77 |
) |
| 78 |
add_custom_target( |
| 79 |
contribute_docs |
| 80 |
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/contribute/contribute.html" "${CMAKE_CURRENT_BINARY_DIR}/contribute/testing.html" "${CMAKE_CURRENT_BINARY_DIR}/contribute/versioning.html" |
| 81 |
) |
| 82 |
# We are not installing the contribute documentation because it does not |
| 83 |
# make any sense to install this for end-users. |
| 84 |
|
| 85 |
add_dependencies(docs user_manual developer_manual contribute_docs) |
| 86 |
endif() |
| 87 |
endif() |