summaryrefslogtreecommitdiff
path: root/legacy/eobj/cmake
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2012-04-16 12:36:42 +0000
committerTom Hacohen <tom@stosb.com>2012-04-16 12:36:42 +0000
commit809a7d4e1ec7f2f917e7e47fd2c460a85d7d49ea (patch)
treef1bd6a44477cd6e9d2b870da56ac80de3ec2ce68 /legacy/eobj/cmake
parent23742813318069c02d05e4807ac19729c9618f08 (diff)
Eobj: Initial doxygen commit.
SVN revision: 70227
Diffstat (limited to 'legacy/eobj/cmake')
-rw-r--r--legacy/eobj/cmake/Modules/UseDoxygen.cmake144
1 files changed, 144 insertions, 0 deletions
diff --git a/legacy/eobj/cmake/Modules/UseDoxygen.cmake b/legacy/eobj/cmake/Modules/UseDoxygen.cmake
new file mode 100644
index 0000000000..377a3f8db2
--- /dev/null
+++ b/legacy/eobj/cmake/Modules/UseDoxygen.cmake
@@ -0,0 +1,144 @@
1# - Run Doxygen
2#
3# Adds a doxygen target that runs doxygen to generate the html
4# and optionally the LaTeX API documentation.
5# The doxygen target is added to the doc target as a dependency.
6# i.e.: the API documentation is built with:
7# make doc
8#
9# USAGE: GLOBAL INSTALL
10#
11# Install it with:
12# cmake ./ && sudo make install
13# Add the following to the CMakeLists.txt of your project:
14# include(UseDoxygen OPTIONAL)
15# Optionally copy Doxyfile.in in the directory of CMakeLists.txt and edit it.
16#
17# USAGE: INCLUDE IN PROJECT
18#
19# set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
20# include(UseDoxygen)
21# Add the Doxyfile.in and UseDoxygen.cmake files to the projects source directory.
22#
23#
24# CONFIGURATION
25#
26# To configure Doxygen you can edit Doxyfile.in and set some variables in cmake.
27# Variables you may define are:
28# DOXYFILE_SOURCE_DIR - Path where the Doxygen input files are.
29# Defaults to the current source directory.
30# DOXYFILE_EXTRA_SOURCES - Additional source diretories/files for Doxygen to scan.
31# The Paths should be in double quotes and separated by space. e.g.:
32# "${CMAKE_CURRENT_BINARY_DIR}/foo.c" "${CMAKE_CURRENT_BINARY_DIR}/bar/"
33#
34# DOXYFILE_OUTPUT_DIR - Path where the Doxygen output is stored.
35# Defaults to "${CMAKE_CURRENT_BINARY_DIR}/doc".
36#
37# DOXYFILE_LATEX - ON/OFF; Set to "ON" if you want the LaTeX documentation
38# to be built.
39# DOXYFILE_LATEX_DIR - Directory relative to DOXYFILE_OUTPUT_DIR where
40# the Doxygen LaTeX output is stored. Defaults to "latex".
41#
42# DOXYFILE_HTML_DIR - Directory relative to DOXYFILE_OUTPUT_DIR where
43# the Doxygen html output is stored. Defaults to "html".
44#
45
46#
47# Copyright (c) 2009, 2010, 2011 Tobias Rautenkranz <tobias@rautenkranz.ch>
48#
49# Redistribution and use is allowed according to the terms of the New
50# BSD license.
51# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
52#
53
54macro(usedoxygen_set_default name value type docstring)
55 if(NOT DEFINED "${name}")
56 set("${name}" "${value}" CACHE "${type}" "${docstring}")
57 endif()
58endmacro()
59
60find_package(Doxygen)
61
62if(DOXYGEN_FOUND)
63 find_file(DOXYFILE_IN "Doxyfile.in"
64 PATHS "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_ROOT}/Modules/"
65 NO_DEFAULT_PATH
66 DOC "Path to the doxygen configuration template file")
67 set(DOXYFILE "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile")
68 include(FindPackageHandleStandardArgs)
69 find_package_handle_standard_args(DOXYFILE_IN DEFAULT_MSG "DOXYFILE_IN")
70endif()
71
72if(DOXYGEN_FOUND AND DOXYFILE_IN_FOUND)
73 usedoxygen_set_default(DOXYFILE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc"
74 PATH "Doxygen output directory")
75 usedoxygen_set_default(DOXYFILE_HTML_DIR "html"
76 STRING "Doxygen HTML output directory")
77 usedoxygen_set_default(DOXYFILE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}"
78 PATH "Input files source directory")
79 usedoxygen_set_default(DOXYFILE_EXTRA_SOURCE_DIRS ""
80 STRING "Additional source files/directories separated by space")
81 set(DOXYFILE_SOURCE_DIRS "\"${DOXYFILE_SOURCE_DIR}\" ${DOXYFILE_EXTRA_SOURCES}")
82
83 usedoxygen_set_default(DOXYFILE_LATEX YES BOOL "Generate LaTeX API documentation" OFF)
84 usedoxygen_set_default(DOXYFILE_LATEX_DIR "latex" STRING "LaTex output directory")
85
86 mark_as_advanced(DOXYFILE_OUTPUT_DIR DOXYFILE_HTML_DIR DOXYFILE_LATEX_DIR
87 DOXYFILE_SOURCE_DIR DOXYFILE_EXTRA_SOURCE_DIRS DOXYFILE_IN)
88
89
90 set_property(DIRECTORY
91 APPEND PROPERTY
92 ADDITIONAL_MAKE_CLEAN_FILES
93 "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_HTML_DIR}")
94
95 add_custom_target(doxygen
96 COMMAND "${DOXYGEN_EXECUTABLE}"
97 "${DOXYFILE}"
98 COMMENT "Writing documentation to ${DOXYFILE_OUTPUT_DIR}..."
99 WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
100
101 set(DOXYFILE_DOT "NO")
102 if(DOXYGEN_DOT_EXECUTABLE)
103 set(DOXYFILE_DOT "YES")
104 endif()
105
106 ## LaTeX
107 set(DOXYFILE_PDFLATEX "NO")
108
109 set_property(DIRECTORY APPEND PROPERTY
110 ADDITIONAL_MAKE_CLEAN_FILES
111 "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}")
112
113 if(DOXYFILE_LATEX STREQUAL "ON")
114 set(DOXYFILE_GENERATE_LATEX "YES")
115 find_package(LATEX)
116 find_program(DOXYFILE_MAKE make)
117 mark_as_advanced(DOXYFILE_MAKE)
118 if(LATEX_COMPILER AND MAKEINDEX_COMPILER AND DOXYFILE_MAKE)
119 if(PDFLATEX_COMPILER)
120 set(DOXYFILE_PDFLATEX "YES")
121 endif()
122
123 add_custom_command(TARGET doxygen
124 POST_BUILD
125 COMMAND "${DOXYFILE_MAKE}"
126 COMMENT "Running LaTeX for Doxygen documentation in ${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}..."
127 WORKING_DIRECTORY "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}")
128 else()
129 set(DOXYGEN_LATEX "NO")
130 endif()
131 else()
132 set(DOXYFILE_GENERATE_LATEX "NO")
133 endif()
134
135
136 configure_file("${DOXYFILE_IN}" "${DOXYFILE}" @ONLY)
137
138 get_target_property(DOC_TARGET doc TYPE)
139 if(NOT DOC_TARGET)
140 add_custom_target(doc)
141 endif()
142
143 add_dependencies(doc doxygen)
144endif()