2016-09-27 19:01:08 +00:00
|
|
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
|
|
|
|
2013-10-15 15:17:36 +00:00
|
|
|
#.rst:
|
|
|
|
# FindLATEX
|
|
|
|
# ---------
|
|
|
|
#
|
|
|
|
# Find Latex
|
|
|
|
#
|
2014-12-05 22:42:48 +00:00
|
|
|
# This module finds an installed Latex and determines the location
|
|
|
|
# of the compiler. Additionally the module looks for Latex-related
|
2014-12-23 10:33:32 +00:00
|
|
|
# software like BibTeX.
|
2012-08-13 17:42:58 +00:00
|
|
|
#
|
2014-12-23 10:33:32 +00:00
|
|
|
# This module sets the following result variables::
|
2002-09-30 16:24:41 +00:00
|
|
|
#
|
2014-12-23 10:33:32 +00:00
|
|
|
# LATEX_FOUND: whether found Latex and requested components
|
|
|
|
# LATEX_<component>_FOUND: whether found <component>
|
2013-10-15 15:17:36 +00:00
|
|
|
# LATEX_COMPILER: path to the LaTeX compiler
|
|
|
|
# PDFLATEX_COMPILER: path to the PdfLaTeX compiler
|
2015-01-10 13:48:31 +00:00
|
|
|
# XELATEX_COMPILER: path to the XeLaTeX compiler
|
|
|
|
# LUALATEX_COMPILER: path to the LuaLaTeX compiler
|
2013-10-15 15:17:36 +00:00
|
|
|
# BIBTEX_COMPILER: path to the BibTeX compiler
|
2015-01-10 11:10:03 +00:00
|
|
|
# BIBER_COMPILER: path to the Biber compiler
|
2013-10-15 15:17:36 +00:00
|
|
|
# MAKEINDEX_COMPILER: path to the MakeIndex compiler
|
2015-01-10 11:10:03 +00:00
|
|
|
# XINDY_COMPILER: path to the xindy compiler
|
2013-10-15 15:17:36 +00:00
|
|
|
# DVIPS_CONVERTER: path to the DVIPS converter
|
2014-12-23 10:33:32 +00:00
|
|
|
# DVIPDF_CONVERTER: path to the DVIPDF converter
|
2013-10-15 15:17:36 +00:00
|
|
|
# PS2PDF_CONVERTER: path to the PS2PDF converter
|
2015-01-10 09:56:35 +00:00
|
|
|
# PDFTOPS_CONVERTER: path to the pdftops converter
|
2013-10-15 15:17:36 +00:00
|
|
|
# LATEX2HTML_CONVERTER: path to the LaTeX2Html converter
|
2015-01-10 09:56:35 +00:00
|
|
|
# HTLATEX_COMPILER: path to the htlatex compiler
|
2014-12-23 10:33:32 +00:00
|
|
|
#
|
|
|
|
# Possible components are::
|
|
|
|
#
|
|
|
|
# PDFLATEX
|
2015-01-10 13:48:31 +00:00
|
|
|
# XELATEX
|
|
|
|
# LUALATEX
|
2014-12-23 10:33:32 +00:00
|
|
|
# BIBTEX
|
2015-01-10 11:10:03 +00:00
|
|
|
# BIBER
|
2014-12-23 10:33:32 +00:00
|
|
|
# MAKEINDEX
|
2015-01-10 11:10:03 +00:00
|
|
|
# XINDY
|
2014-12-23 10:33:32 +00:00
|
|
|
# DVIPS
|
|
|
|
# DVIPDF
|
|
|
|
# PS2PDF
|
2015-01-10 09:56:35 +00:00
|
|
|
# PDFTOPS
|
2014-12-23 10:33:32 +00:00
|
|
|
# LATEX2HTML
|
2015-01-10 09:56:35 +00:00
|
|
|
# HTLATEX
|
2014-12-23 10:33:32 +00:00
|
|
|
#
|
|
|
|
# Example Usages::
|
|
|
|
#
|
|
|
|
# find_package(LATEX)
|
|
|
|
# find_package(LATEX COMPONENTS PDFLATEX)
|
|
|
|
# find_package(LATEX COMPONENTS BIBTEX PS2PDF)
|
2002-09-30 16:24:41 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
if (WIN32)
|
2003-01-23 15:37:46 +00:00
|
|
|
# Try to find the MikTex binary path (look for its package manager).
|
2012-08-13 17:47:32 +00:00
|
|
|
find_path(MIKTEX_BINARY_PATH mpm.exe
|
2003-01-23 15:37:46 +00:00
|
|
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\MiK\\MiKTeX\\CurrentVersion\\MiKTeX;Install Root]/miktex/bin"
|
2012-08-13 17:42:58 +00:00
|
|
|
DOC
|
2003-01-23 15:37:46 +00:00
|
|
|
"Path to the MikTex binary directory."
|
|
|
|
)
|
2012-08-13 17:47:32 +00:00
|
|
|
mark_as_advanced(MIKTEX_BINARY_PATH)
|
2003-01-23 15:37:46 +00:00
|
|
|
|
|
|
|
# Try to find the GhostScript binary path (look for gswin32).
|
2012-08-13 17:47:32 +00:00
|
|
|
get_filename_component(GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_8_00
|
2003-01-23 15:37:46 +00:00
|
|
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\AFPL Ghostscript\\8.00;GS_DLL]" PATH
|
|
|
|
)
|
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
get_filename_component(GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_7_04
|
2003-01-23 15:37:46 +00:00
|
|
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\AFPL Ghostscript\\7.04;GS_DLL]" PATH
|
|
|
|
)
|
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
find_path(GHOSTSCRIPT_BINARY_PATH gswin32.exe
|
2003-01-23 15:37:46 +00:00
|
|
|
${GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_8_00}
|
|
|
|
${GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_7_04}
|
|
|
|
DOC "Path to the GhostScript binary directory."
|
|
|
|
)
|
2012-08-13 17:47:32 +00:00
|
|
|
mark_as_advanced(GHOSTSCRIPT_BINARY_PATH)
|
2003-01-23 15:37:46 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
find_path(GHOSTSCRIPT_LIBRARY_PATH ps2pdf13.bat
|
2003-01-23 15:37:46 +00:00
|
|
|
"${GHOSTSCRIPT_BINARY_PATH}/../lib"
|
|
|
|
DOC "Path to the GhostScript library directory."
|
|
|
|
)
|
2012-08-13 17:47:32 +00:00
|
|
|
mark_as_advanced(GHOSTSCRIPT_LIBRARY_PATH)
|
2012-08-13 17:50:14 +00:00
|
|
|
endif ()
|
2003-01-23 15:37:46 +00:00
|
|
|
|
2014-12-23 10:33:32 +00:00
|
|
|
# try to find Latex and the related programs
|
2012-08-13 17:47:32 +00:00
|
|
|
find_program(LATEX_COMPILER
|
2002-09-30 16:24:41 +00:00
|
|
|
NAMES latex
|
2003-01-23 15:37:46 +00:00
|
|
|
PATHS ${MIKTEX_BINARY_PATH}
|
2003-01-28 13:53:27 +00:00
|
|
|
/usr/bin
|
2002-09-30 16:24:41 +00:00
|
|
|
)
|
|
|
|
|
2014-12-23 10:33:32 +00:00
|
|
|
# find pdflatex
|
2012-08-13 17:47:32 +00:00
|
|
|
find_program(PDFLATEX_COMPILER
|
2003-08-07 20:32:20 +00:00
|
|
|
NAMES pdflatex
|
|
|
|
PATHS ${MIKTEX_BINARY_PATH}
|
|
|
|
/usr/bin
|
|
|
|
)
|
2014-12-23 10:33:32 +00:00
|
|
|
if (PDFLATEX_COMPILER)
|
|
|
|
set(LATEX_PDFLATEX_FOUND TRUE)
|
|
|
|
else()
|
|
|
|
set(LATEX_PDFLATEX_FOUND FALSE)
|
|
|
|
endif()
|
2003-08-07 20:32:20 +00:00
|
|
|
|
2015-01-10 13:48:31 +00:00
|
|
|
# find xelatex
|
|
|
|
find_program(XELATEX_COMPILER
|
|
|
|
NAMES xelatex
|
|
|
|
PATHS ${MIKTEX_BINARY_PATH}
|
|
|
|
/usr/bin
|
|
|
|
)
|
|
|
|
if (XELATEX_COMPILER)
|
|
|
|
set(LATEX_XELATEX_FOUND TRUE)
|
|
|
|
else()
|
|
|
|
set(LATEX_XELATEX_FOUND FALSE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# find lualatex
|
|
|
|
find_program(LUALATEX_COMPILER
|
|
|
|
NAMES lualatex
|
|
|
|
PATHS ${MIKTEX_BINARY_PATH}
|
|
|
|
/usr/bin
|
|
|
|
)
|
|
|
|
if (LUALATEX_COMPILER)
|
|
|
|
set(LATEX_LUALATEX_FOUND TRUE)
|
|
|
|
else()
|
|
|
|
set(LATEX_LUALATEX_FOUND FALSE)
|
|
|
|
endif()
|
|
|
|
|
2014-12-23 10:33:32 +00:00
|
|
|
# find bibtex
|
2012-08-13 17:47:32 +00:00
|
|
|
find_program(BIBTEX_COMPILER
|
2002-09-30 16:24:41 +00:00
|
|
|
NAMES bibtex
|
2003-01-23 15:37:46 +00:00
|
|
|
PATHS ${MIKTEX_BINARY_PATH}
|
2003-01-28 13:53:27 +00:00
|
|
|
/usr/bin
|
2002-09-30 16:24:41 +00:00
|
|
|
)
|
2014-12-23 10:33:32 +00:00
|
|
|
if (BIBTEX_COMPILER)
|
|
|
|
set(LATEX_BIBTEX_FOUND TRUE)
|
|
|
|
else()
|
|
|
|
set(LATEX_BIBTEX_FOUND FALSE)
|
|
|
|
endif()
|
2002-09-30 16:24:41 +00:00
|
|
|
|
2015-01-10 11:10:03 +00:00
|
|
|
# find biber
|
|
|
|
find_program(BIBER_COMPILER
|
|
|
|
NAMES biber
|
|
|
|
PATHS ${MIKTEX_BINARY_PATH}
|
|
|
|
/usr/bin
|
|
|
|
)
|
|
|
|
if (BIBER_COMPILER)
|
|
|
|
set(LATEX_BIBER_FOUND TRUE)
|
|
|
|
else()
|
|
|
|
set(LATEX_BIBER_FOUND FALSE)
|
|
|
|
endif()
|
|
|
|
|
2014-12-23 10:33:32 +00:00
|
|
|
# find makeindex
|
2012-08-13 17:47:32 +00:00
|
|
|
find_program(MAKEINDEX_COMPILER
|
2003-01-23 15:37:46 +00:00
|
|
|
NAMES makeindex
|
|
|
|
PATHS ${MIKTEX_BINARY_PATH}
|
2003-01-28 13:53:27 +00:00
|
|
|
/usr/bin
|
2002-09-30 16:24:41 +00:00
|
|
|
)
|
2014-12-23 10:33:32 +00:00
|
|
|
if (MAKEINDEX_COMPILER)
|
|
|
|
set(LATEX_MAKEINDEX_FOUND TRUE)
|
|
|
|
else()
|
|
|
|
set(LATEX_MAKEINDEX_FOUND FALSE)
|
|
|
|
endif()
|
2002-09-30 16:24:41 +00:00
|
|
|
|
2015-01-10 11:10:03 +00:00
|
|
|
# find xindy
|
|
|
|
find_program(XINDY_COMPILER
|
|
|
|
NAMES xindy
|
|
|
|
PATHS ${MIKTEX_BINARY_PATH}
|
|
|
|
/usr/bin
|
|
|
|
)
|
|
|
|
if (XINDY_COMPILER)
|
|
|
|
set(LATEX_XINDY_FOUND TRUE)
|
|
|
|
else()
|
|
|
|
set(LATEX_XINDY_FOUND FALSE)
|
|
|
|
endif()
|
|
|
|
|
2014-12-23 10:33:32 +00:00
|
|
|
# find dvips
|
2012-08-13 17:47:32 +00:00
|
|
|
find_program(DVIPS_CONVERTER
|
2002-09-30 16:24:41 +00:00
|
|
|
NAMES dvips
|
2003-01-23 15:37:46 +00:00
|
|
|
PATHS ${MIKTEX_BINARY_PATH}
|
2003-01-28 13:53:27 +00:00
|
|
|
/usr/bin
|
|
|
|
)
|
2014-12-23 10:33:32 +00:00
|
|
|
if (DVIPS_CONVERTER)
|
|
|
|
set(LATEX_DVIPS_FOUND TRUE)
|
|
|
|
else()
|
|
|
|
set(LATEX_DVIPS_FOUND FALSE)
|
|
|
|
endif()
|
2003-01-28 13:53:27 +00:00
|
|
|
|
2014-12-23 10:33:32 +00:00
|
|
|
# find dvipdf
|
2012-08-13 17:47:32 +00:00
|
|
|
find_program(DVIPDF_CONVERTER
|
2003-01-28 13:53:27 +00:00
|
|
|
NAMES dvipdfm dvipdft dvipdf
|
|
|
|
PATHS ${MIKTEX_BINARY_PATH}
|
|
|
|
/usr/bin
|
2002-09-30 16:24:41 +00:00
|
|
|
)
|
2014-12-23 10:33:32 +00:00
|
|
|
if (DVIPDF_CONVERTER)
|
|
|
|
set(LATEX_DVIPDF_FOUND TRUE)
|
|
|
|
else()
|
|
|
|
set(LATEX_DVIPDF_FOUND FALSE)
|
|
|
|
endif()
|
2002-09-30 16:24:41 +00:00
|
|
|
|
2014-12-23 10:33:32 +00:00
|
|
|
# find ps2pdf
|
2012-08-13 17:47:32 +00:00
|
|
|
if (WIN32)
|
|
|
|
find_program(PS2PDF_CONVERTER
|
2014-10-07 13:40:42 +00:00
|
|
|
NAMES ps2pdf14.bat ps2pdf14 ps2pdf
|
2003-01-23 15:37:46 +00:00
|
|
|
PATHS ${GHOSTSCRIPT_LIBRARY_PATH}
|
2013-09-25 15:51:29 +00:00
|
|
|
${MIKTEX_BINARY_PATH}
|
2003-01-23 15:37:46 +00:00
|
|
|
)
|
2012-08-13 17:50:14 +00:00
|
|
|
else ()
|
2012-08-13 17:47:32 +00:00
|
|
|
find_program(PS2PDF_CONVERTER
|
2003-08-19 12:53:14 +00:00
|
|
|
NAMES ps2pdf14 ps2pdf
|
2003-01-23 15:37:46 +00:00
|
|
|
)
|
2012-08-13 17:50:14 +00:00
|
|
|
endif ()
|
2014-12-23 10:33:32 +00:00
|
|
|
if (PS2PDF_CONVERTER)
|
|
|
|
set(LATEX_PS2PDF_FOUND TRUE)
|
|
|
|
else()
|
|
|
|
set(LATEX_PS2PDF_FOUND FALSE)
|
|
|
|
endif()
|
2003-01-22 16:11:41 +00:00
|
|
|
|
2015-01-10 09:56:35 +00:00
|
|
|
# find pdftops
|
|
|
|
find_program(PDFTOPS_CONVERTER
|
|
|
|
NAMES pdftops
|
|
|
|
PATHS ${MIKTEX_BINARY_PATH}
|
|
|
|
/usr/bin
|
|
|
|
)
|
|
|
|
if (PDFTOPS_CONVERTER)
|
|
|
|
set(LATEX_PDFTOPS_FOUND TRUE)
|
|
|
|
else()
|
|
|
|
set(LATEX_PDFTOPS_FOUND FALSE)
|
|
|
|
endif()
|
|
|
|
|
2014-12-23 10:33:32 +00:00
|
|
|
# find latex2html
|
2012-08-13 17:47:32 +00:00
|
|
|
find_program(LATEX2HTML_CONVERTER
|
2003-08-07 20:32:20 +00:00
|
|
|
NAMES latex2html
|
|
|
|
PATHS ${MIKTEX_BINARY_PATH}
|
|
|
|
/usr/bin
|
|
|
|
)
|
2014-12-23 10:33:32 +00:00
|
|
|
if (LATEX2HTML_CONVERTER)
|
|
|
|
set(LATEX_LATEX2HTML_FOUND TRUE)
|
|
|
|
else()
|
|
|
|
set(LATEX_LATEX2HTML_FOUND FALSE)
|
|
|
|
endif()
|
2003-08-07 20:32:20 +00:00
|
|
|
|
2015-01-10 09:56:35 +00:00
|
|
|
# find htlatex
|
|
|
|
find_program(HTLATEX_COMPILER
|
|
|
|
NAMES htlatex
|
|
|
|
PATHS ${MIKTEX_BINARY_PATH}
|
|
|
|
/usr/bin
|
|
|
|
)
|
|
|
|
if (HTLATEX_COMPILER)
|
|
|
|
set(LATEX_HTLATEX_FOUND TRUE)
|
|
|
|
else()
|
|
|
|
set(LATEX_HTLATEX_FOUND FALSE)
|
|
|
|
endif()
|
|
|
|
|
2003-08-07 20:32:20 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
mark_as_advanced(
|
2003-01-23 15:37:46 +00:00
|
|
|
LATEX_COMPILER
|
2003-08-07 20:32:20 +00:00
|
|
|
PDFLATEX_COMPILER
|
2015-01-10 13:48:31 +00:00
|
|
|
XELATEX_COMPILER
|
|
|
|
LUALATEX_COMPILER
|
2003-01-23 15:37:46 +00:00
|
|
|
BIBTEX_COMPILER
|
2015-01-10 11:10:03 +00:00
|
|
|
BIBER_COMPILER
|
2003-01-23 15:37:46 +00:00
|
|
|
MAKEINDEX_COMPILER
|
2015-01-10 11:10:03 +00:00
|
|
|
XINDY_COMPILER
|
2003-01-23 15:37:46 +00:00
|
|
|
DVIPS_CONVERTER
|
2003-10-30 18:33:51 +00:00
|
|
|
DVIPDF_CONVERTER
|
2003-01-23 15:37:46 +00:00
|
|
|
PS2PDF_CONVERTER
|
2015-01-10 09:56:35 +00:00
|
|
|
PDFTOPS_CONVERTER
|
2003-08-07 20:32:20 +00:00
|
|
|
LATEX2HTML_CONVERTER
|
2015-01-10 09:56:35 +00:00
|
|
|
HTLATEX_COMPILER
|
2003-01-23 15:37:46 +00:00
|
|
|
)
|
2014-12-05 22:42:48 +00:00
|
|
|
|
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
2014-12-23 10:33:32 +00:00
|
|
|
find_package_handle_standard_args(LATEX
|
2014-12-05 22:42:48 +00:00
|
|
|
REQUIRED_VARS LATEX_COMPILER
|
2014-12-23 10:33:32 +00:00
|
|
|
HANDLE_COMPONENTS
|
2014-12-05 22:42:48 +00:00
|
|
|
)
|