[build] GiNaC can be built with CMake now.
[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         add_custom_command(
39                 OUTPUT ${_idx}
40                 COMMAND ${PDFLATEX_COMPILER} ${texfile}
41                 WORKING_DIRECTORY ${_dirname}
42                 DEPENDS ${texfile}
43                 COMMENT "PDFLATEX ${_basename}.tex (1)")
44         add_custom_command(
45                 OUTPUT ${_ind}
46                 COMMAND ${MAKEINDEX_COMPILER} ${_idx}
47                 WORKING_DIRECTORY ${_dirname}
48                 DEPENDS ${texfile} ${_idx}
49                 COMMENT "MAKEINDEX ${_basename}.idx")
50         add_custom_command(
51                 OUTPUT ${_pdf}
52                 COMMAND ${PDFLATEX_COMPILER} ${texfile}
53                 WORKING_DIRECTORY ${_dirname}
54                 DEPENDS ${texfile} ${_ind}
55                 COMMENT "PDFLATEX ${_basename}.tex (2)")
56 endmacro()
57
58 add_subdirectory(tutorial)
59 add_subdirectory(examples)
60 if (DOXYGEN_FOUND)
61         add_subdirectory(reference)
62 endif()
63