Work around Tex Live 2012 versus doxygen problem.
[ginac.git] / doc / CMakeLists.txt
1 find_package(Doxygen)
2 find_program(FIG2DEV fig2dev)
3 find_program(TEXI2DVI texi2dvi)
4 find_package(LATEX)
5 if (PDFLATEX_COMPILER AND MAKEINDEX_COMPILER)
6         set(LATEX_FOUND true)
7 endif()
8
9 macro(add_info_file thename)
10         set(${thename}_INFO ${CMAKE_CURRENT_BINARY_DIR}/${thename}.info)
11         set(${thename}_HTML ${CMAKE_CURRENT_BINARY_DIR}/${thename}.html)
12         set(${thename}_TEXINFO ${CMAKE_CURRENT_SOURCE_DIR}/${thename}.texi)
13         add_custom_command(
14                 OUTPUT ${${thename}_INFO}
15                 COMMAND ${MAKEINFO} --no-split -o ${${thename}_INFO} ${${thename}_TEXINFO}
16                 DEPENDS ${${thename}_TEXINFO}
17                 COMMENT "MAKEFINO ${thename}.texi"
18                 VERBATIM)
19         add_custom_command(
20                 OUTPUT ${${thename}_HTML}
21                 COMMAND ${MAKEINFO} --html --no-split -o ${${thename}_HTML} ${${thename}_TEXINFO}
22                 DEPENDS ${${thename}_TEXINFO} ${${thename}_HTML_EXTRA_DEPS}
23                 COMMENT "MAKEINFOHTML ${thename}.texi"
24                 VERBATIM)
25         add_custom_target(${thename}_info ALL DEPENDS ${${thename}_INFO})
26         add_custom_target(${thename}_html DEPENDS ${${thename}_HTML})
27         add_dependencies(info ${thename}_info)
28         add_dependencies(html ${thename}_html)
29         install(FILES ${${thename}_INFO} DESTINATION "${SHARE_INSTALL_PREFIX}/info")
30 endmacro()
31
32 macro(pdflatex_process texfile)
33         get_filename_component(_dirname "${texfile}" PATH)
34         get_filename_component(_basename "${texfile}" NAME_WE)
35         set(_idx ${_dirname}/${_basename}.idx)
36         set(_ind ${_dirname}/${_basename}.ind)
37         set(_pdf ${_dirname}/${_basename}.pdf)
38         set(_fixupind ${CMAKE_SOURCE_DIR}/scripts/fixupind.py)
39         add_custom_command(
40                 OUTPUT ${_idx}
41                 COMMAND ${PDFLATEX_COMPILER} ${texfile}
42                 WORKING_DIRECTORY ${_dirname}
43                 DEPENDS ${texfile}
44                 COMMENT "PDFLATEX ${_basename}.tex (1)")
45         add_custom_command(
46                 OUTPUT ${_ind}
47                 COMMAND ${MAKEINDEX_COMPILER} ${_idx}
48                 COMMAND python ${_fixupind} ${_idx}
49                 WORKING_DIRECTORY ${_dirname}
50                 DEPENDS ${texfile} ${_idx}
51                 COMMENT "MAKEINDEX ${_basename}.idx")
52         add_custom_command(
53                 OUTPUT ${_pdf}
54                 COMMAND ${PDFLATEX_COMPILER} ${texfile}
55                 WORKING_DIRECTORY ${_dirname}
56                 DEPENDS ${texfile} ${_ind}
57                 COMMENT "PDFLATEX ${_basename}.tex (2)")
58 endmacro()
59
60 add_subdirectory(tutorial)
61 add_subdirectory(examples)
62 if (DOXYGEN_FOUND)
63         add_subdirectory(reference)
64 endif()
65