ENH: fix advanced bug
[cmake.git] / Modules / FindLATEX.cmake
bloba02d9e1795f972c3986deeee01ca352e6e9bb685
1 # - Find Latex
2 # This module finds if Latex is installed and determines where the
3 # executables are. This code sets the following variables:
4 #  
5 #  LATEX_COMPILER:       path to the LaTeX compiler
6 #  PDFLATEX_COMPILER:    path to the PdfLaTeX compiler
7 #  BIBTEX_COMPILER:      path to the BibTeX compiler
8 #  MAKEINDEX_COMPILER:   path to the MakeIndex compiler
9 #  DVIPS_CONVERTER:      path to the DVIPS converter
10 #  PS2PDF_CONVERTER:     path to the PS2PDF converter
11 #  LATEX2HTML_CONVERTER: path to the LaTeX2Html converter 
14 IF (WIN32)
16   # Try to find the MikTex binary path (look for its package manager).
18   FIND_PATH(MIKTEX_BINARY_PATH mpm.exe
19     "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MiK\\MiKTeX\\CurrentVersion\\MiKTeX;Install Root]/miktex/bin"
20     DOC 
21     "Path to the MikTex binary directory."
22   )
23   MARK_AS_ADVANCED(MIKTEX_BINARY_PATH)
25   # Try to find the GhostScript binary path (look for gswin32).
27   GET_FILENAME_COMPONENT(GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_8_00
28      "[HKEY_LOCAL_MACHINE\\SOFTWARE\\AFPL Ghostscript\\8.00;GS_DLL]" PATH
29   )
31   GET_FILENAME_COMPONENT(GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_7_04
32      "[HKEY_LOCAL_MACHINE\\SOFTWARE\\AFPL Ghostscript\\7.04;GS_DLL]" PATH
33   )
35   FIND_PATH(GHOSTSCRIPT_BINARY_PATH gswin32.exe
36     ${GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_8_00}
37     ${GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_7_04}
38     DOC "Path to the GhostScript binary directory."
39   )
40   MARK_AS_ADVANCED(GHOSTSCRIPT_BINARY_PATH)
42   FIND_PATH(GHOSTSCRIPT_LIBRARY_PATH ps2pdf13.bat
43     "${GHOSTSCRIPT_BINARY_PATH}/../lib"
44     DOC "Path to the GhostScript library directory."
45   )
46   MARK_AS_ADVANCED(GHOSTSCRIPT_LIBRARY_PATH)
48 ENDIF (WIN32)
50 FIND_PROGRAM(LATEX_COMPILER
51   NAMES latex
52   PATHS ${MIKTEX_BINARY_PATH}
53         /usr/bin
56 FIND_PROGRAM(PDFLATEX_COMPILER
57   NAMES pdflatex
58   PATHS ${MIKTEX_BINARY_PATH}
59         /usr/bin
62 FIND_PROGRAM(BIBTEX_COMPILER
63   NAMES bibtex
64   PATHS ${MIKTEX_BINARY_PATH}
65         /usr/bin
68 FIND_PROGRAM(MAKEINDEX_COMPILER
69   NAMES makeindex
70   PATHS ${MIKTEX_BINARY_PATH}
71         /usr/bin
74 FIND_PROGRAM(DVIPS_CONVERTER
75   NAMES dvips
76   PATHS ${MIKTEX_BINARY_PATH}
77         /usr/bin
80 FIND_PROGRAM(DVIPDF_CONVERTER
81   NAMES dvipdfm dvipdft dvipdf
82   PATHS ${MIKTEX_BINARY_PATH}
83         /usr/bin
86 IF (WIN32)
87   FIND_PROGRAM(PS2PDF_CONVERTER
88     NAMES ps2pdf14.bat
89     PATHS ${GHOSTSCRIPT_LIBRARY_PATH}
90   )
91 ELSE (WIN32)
92   FIND_PROGRAM(PS2PDF_CONVERTER
93     NAMES ps2pdf14 ps2pdf
94   )
95 ENDIF (WIN32)
97 FIND_PROGRAM(LATEX2HTML_CONVERTER
98   NAMES latex2html
99   PATHS ${MIKTEX_BINARY_PATH}
100         /usr/bin
104 MARK_AS_ADVANCED(
105   LATEX_COMPILER
106   PDFLATEX_COMPILER
107   BIBTEX_COMPILER
108   MAKEINDEX_COMPILER
109   DVIPS_CONVERTER
110   DVIPDF_CONVERTER
111   PS2PDF_CONVERTER
112   LATEX2HTML_CONVERTER