1#
2# - Find Doxygen
3# This module looks for a native (non-Cygwin) Doxygen.
4#
5
6find_program( DOXYGEN_EXECUTABLE
7  NAMES
8    doxygen
9  PATHS
10    /bin
11    /usr/bin
12    /usr/local/bin
13    /sbin
14    $ENV{ProgramFiles}/doxygen/bin
15)
16
17# We set various paths in doxygen.cfg via configure_file(). These are
18# native system paths which aren't compatible with Cygwin's Doxygen.
19string(TOLOWER ${DOXYGEN_EXECUTABLE} _de_lower)
20if(${_de_lower} MATCHES "cyg")
21	set(_ignore_reason "Cygwin Doxygen found at ${DOXYGEN_EXECUTABLE}. Ignoring.")
22	message(STATUS ${_ignore_reason})
23	set(DOXYGEN_EXECUTABLE DOXYGEN_EXECUTABLE-NOTFOUND CACHE FILEPATH ${_ignore_reason} FORCE)
24endif()
25
26include( FindPackageHandleStandardArgs )
27find_package_handle_standard_args( DOXYGEN DEFAULT_MSG DOXYGEN_EXECUTABLE )
28
29mark_as_advanced( DOXYGEN_EXECUTABLE )
30
31macro( DOXYGEN2HTML _output )
32	GET_FILENAME_COMPONENT(_OUTDIR ${_output} PATH)
33	SET(_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/${_OUTDIR})
34
35	add_custom_command(
36		OUTPUT
37		COMMAND cmake
38			-E make_directory ${_OUTDIR}
39		COMMAND $(DOXYGEN_EXECUTABLE)
40			doxygen.cfg
41		COMMAND chmod
42			-R og+rX ${_OUTDIR}
43		DEPENDS
44			doxygen.cfg
45	)
46endmacro()
47
48