forked from Eyescale/CMake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommonDocumentation.cmake
54 lines (48 loc) · 1.98 KB
/
CommonDocumentation.cmake
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
# Copyright (c) 2012-2014 Raphael Dumusc <[email protected]>
# Configure the build for a documentation project:
# common_documentation()
#
# Generates:
# * doxygit target
# * install target (optional)
#
# The doxygit target executes Doxygit.cmake as a script in the source
# directory of the project. It updates the index page, removes outdated
# documentation folders and 'git add' the changes.
#
# Input (optional):
# * DOXYGIT_MAX_VERSIONS number of versions to keep in directory (default: 10)
# * DOXYGIT_TOC_POST html content to insert in 'index.html' (default: '')
#
# * COMMON_INSTALL_DOCUMENTATION if set to ON, generate a 'make install' target
# which installs all the documentation under share/${PROJECT_NAME}/.
# Default: OFF because it is called by each dependant project when doing a
# regular release build using Buildyard, which can be very time consuming.
function(COMMON_DOCUMENTATION)
add_custom_target(${PROJECT_NAME}_doxygit
COMMAND ${CMAKE_COMMAND}
-DPROJECT_NAME="${PROJECT_NAME}"
-DDOXYGIT_TOC_POST:STRING="${DOXYGIT_TOC_POST}"
-DDOXYGIT_MAX_VERSIONS="${DOXYGIT_MAX_VERSIONS}"
-P "${PROJECT_SOURCE_DIR}/CMake/common/Doxygit.cmake"
COMMENT "Updating documentation in ${PROJECT_SOURCE_DIR}"
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
# For meta project, separate doxygit and ${PROJECT_NAME}_doxygit
if(NOT TARGET doxygit)
add_custom_target(doxygit)
endif()
add_dependencies(doxygit ${PROJECT_NAME}_doxygit)
if(COMMON_INSTALL_DOCUMENTATION)
file(GLOB Folders RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *-*)
foreach(FOLDER ${Folders})
install(DIRECTORY ${FOLDER} DESTINATION share/${PROJECT_NAME}
CONFIGURATIONS Release)
endforeach()
# need at least one file for 'make install'
install(FILES index.html DESTINATION share/${PROJECT_NAME}
CONFIGURATIONS Release)
else()
# Buildyard expects an install target for all projects
install(CODE "MESSAGE(\"Nothing to install, done.\")")
endif()
endfunction()