1# Setup doxygen stuff.  Only really of interest to devs...
2
3find_package(Doxygen)
4if(DOXYGEN_FOUND)
5	# Few configurable params
6	if(NOT DOXYGEN_DIR)
7		set(DOXYGEN_DIR "${CMAKE_CURRENT_BINARY_DIR}/doxygen")
8	endif()
9	if(NOT DOXYGEN_HAVE_DOT)
10		# String YES/NO; let user override what find_package() got.
11		set(DOXYGEN_HAVE_DOT ${DOXYGEN_DOT_FOUND})
12	endif()
13	if(NOT DOXYGEN_GRAPHIC_CALLGRAPHS)
14		# String YES/NO.  These are expensive to generate and big.
15		set(DOXYGEN_GRAPHIC_CALLGRAPHS "NO")
16	endif()
17
18	# The config codes the paths to the files, so we need to set them
19	configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in"
20		"${DOXYGEN_DIR}/Doxyfile" @ONLY)
21
22	# Special target, since it hardly ever gets used.  We need to pull in
23	# the various generated source files, and the easiest way to ensure
24	# they're all these is to just build ctwm.  That gets a little
25	# tedious when working on docs though, so try depending on CTWMSRC.
26	# That seems to work well enough, and if we find edge cases that
27	# break it...   well, it's a tool for devs, not end users, so we can
28	# afford the possibility of surprises.
29	add_custom_target(doxygen
30		DEPENDS ${CTWMSRC}
31		COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_DIR}/Doxyfile
32		WORKING_DIRECTORY ${DOXYGEN_DIR}
33		COMMENT "Generating Doxygen documentation in ${DOXYGEN_DIR}"
34		VERBATIM)
35
36	add_custom_target(doxyclean
37		COMMAND rm -rf ${DOXYGEN_DIR}/html
38		COMMENT "Cleaning up Doxygen docs")
39endif(DOXYGEN_FOUND)
40