Re: [cmake-developers] Which binaries should be required in FindLATEX?
On 1/10/2015 4:03 PM, Christoph Grüninger wrote: The link does not work and I couldn't find the commit in next. Can you double check whether you pushed it? Oops, thanks. I pushed it to our staging repo but never merged to 'next'. Done now, along with the below. Additionally I attached patches to add more LaTeX-related component we should test. This includes Biber (BibTeX replacement), xindy (makeindex replacement), pdftops, htlatex (compiler to HTML), XeLaTeX and LuaLaTeX. Applied, thanks: FindLATEX: Add components PDFtoPS and HTLATEX http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=222ee2c0 FindLATEX: Add components Biber and xindy http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c32f6919 FindLATEX: Add components for XeLaTeX and LuaLaTeX http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=89e08de8 -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] Which binaries should be required in FindLATEX?
Hi Brad, concerning FindLATEX again: Applied: FindLATEX: Add components handling http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=07a3f9ad The link does not work and I couldn't find the commit in next. Can you double check whether you pushed it? with minor documentation tweaks and one logic fix: -# set(LATEX_MAKEINDEX_FOUND TRUE) + set(LATEX_MAKEINDEX_FOUND TRUE) that looked left from local testing. Sorry, you are right. Thanks for the heads-up. I attached the right patch this time. Additionally I attached patches to add more LaTeX-related component we should test. This includes Biber (BibTeX replacement), xindy (makeindex replacement), pdftops, htlatex (compiler to HTML), XeLaTeX and LuaLaTeX. Bye Christoph From b140186f9e712705d7c33bf71dd9c2dc592b871e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= gruen...@dune-project.org Date: Sun, 28 Dec 2014 09:58:53 +0100 Subject: [PATCH 1/4] FindLATEX: Add components handling --- Modules/FindLATEX.cmake | 78 + 1 file changed, 72 insertions(+), 6 deletions(-) diff --git a/Modules/FindLATEX.cmake b/Modules/FindLATEX.cmake index a935f00..a6c8937 100644 --- a/Modules/FindLATEX.cmake +++ b/Modules/FindLATEX.cmake @@ -6,17 +6,42 @@ # # This module finds an installed Latex and determines the location # of the compiler. Additionally the module looks for Latex-related -# software like BibTeX. This code sets the following variables: +# software like BibTeX. +# +# This module sets the following result variables: # # :: # +# LATEX_FOUND: whether found Latex and requested components +# LATEX_component_FOUND: whether found component # LATEX_COMPILER: path to the LaTeX compiler # PDFLATEX_COMPILER:path to the PdfLaTeX compiler # BIBTEX_COMPILER: path to the BibTeX compiler # MAKEINDEX_COMPILER: path to the MakeIndex compiler # DVIPS_CONVERTER: path to the DVIPS converter +# DVIPDF_CONVERTER: path to the DVIPDF converter # PS2PDF_CONVERTER: path to the PS2PDF converter # LATEX2HTML_CONVERTER: path to the LaTeX2Html converter +# +# Possible components are: +# +# :: +# +# PDFLATEX +# BIBTEX +# MAKEINDEX +# DVIPS +# DVIPDF +# PS2PDF +# LATEX2HTML +# +# Example Usages: +# +# :: +# +# find_package(LATEX) +# find_package(LATEX COMPONENTS PDFLATEX) +# find_package(LATEX COMPONENTS BIBTEX PS2PDF) #= # Copyright 2002-2014 Kitware, Inc. @@ -32,9 +57,7 @@ # License text for the above reference.) if (WIN32) - # Try to find the MikTex binary path (look for its package manager). - find_path(MIKTEX_BINARY_PATH mpm.exe [HKEY_LOCAL_MACHINE\\SOFTWARE\\MiK\\MiKTeX\\CurrentVersion\\MiKTeX;Install Root]/miktex/bin DOC @@ -43,7 +66,6 @@ if (WIN32) mark_as_advanced(MIKTEX_BINARY_PATH) # Try to find the GhostScript binary path (look for gswin32). - get_filename_component(GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_8_00 [HKEY_LOCAL_MACHINE\\SOFTWARE\\AFPL Ghostscript\\8.00;GS_DLL] PATH ) @@ -64,45 +86,76 @@ if (WIN32) DOC Path to the GhostScript library directory. ) mark_as_advanced(GHOSTSCRIPT_LIBRARY_PATH) - endif () +# try to find Latex and the related programs find_program(LATEX_COMPILER NAMES latex PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +# find pdflatex find_program(PDFLATEX_COMPILER NAMES pdflatex PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +if (PDFLATEX_COMPILER) + set(LATEX_PDFLATEX_FOUND TRUE) +else() + set(LATEX_PDFLATEX_FOUND FALSE) +endif() +# find bibtex find_program(BIBTEX_COMPILER NAMES bibtex PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +if (BIBTEX_COMPILER) + set(LATEX_BIBTEX_FOUND TRUE) +else() + set(LATEX_BIBTEX_FOUND FALSE) +endif() +# find makeindex find_program(MAKEINDEX_COMPILER NAMES makeindex PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +if (MAKEINDEX_COMPILER) + set(LATEX_MAKEINDEX_FOUND TRUE) +else() + set(LATEX_MAKEINDEX_FOUND FALSE) +endif() +# find dvips find_program(DVIPS_CONVERTER NAMES dvips PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +if (DVIPS_CONVERTER) + set(LATEX_DVIPS_FOUND TRUE) +else() + set(LATEX_DVIPS_FOUND FALSE) +endif() +# find dvipdf find_program(DVIPDF_CONVERTER NAMES dvipdfm dvipdft dvipdf PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +if (DVIPDF_CONVERTER) + set(LATEX_DVIPDF_FOUND TRUE) +else() + set(LATEX_DVIPDF_FOUND FALSE) +endif() +# find ps2pdf if (WIN32) find_program(PS2PDF_CONVERTER NAMES ps2pdf14.bat ps2pdf14 ps2pdf @@ -114,12 +167,23 @@ else () NAMES ps2pdf14 ps2pdf ) endif () +if (PS2PDF_CONVERTER) + set(LATEX_PS2PDF_FOUND TRUE) +else() + set(LATEX_PS2PDF_FOUND FALSE) +endif() +# find latex2html find_program(LATEX2HTML_CONVERTER NAMES latex2html PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +if
Re: [cmake-developers] Which binaries should be required in FindLATEX?
On 12/22/2014 6:29 PM, Christoph Grüninger wrote: please find attached a new patch following your latest suggestions. Thanks. I'd like to have lower case components but I dislike mixed-cased variable names. The latter feeling is stronger. Mixed-case variable names are quite common in CMake APIs, especially when dealing with components like this, but I don't have a strong feeling either way on this. However, the _FOUND variables are not cache entries so they do not need to appear in mark_as_advanced. -find_package_handle_standard_args(Latex +find_package_handle_standard_args(LATEX Good catch. The capitalization should match the name of the find module. This was a mistake in the original FPHSA change for FindLATEX. Thanks, -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] Which binaries should be required in FindLATEX?
Hi Brad, next try and as always better than the last attempt. Bye Christoph From ba775bd58b70ad2581fc05f30d8c5e42e1c94096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= gruen...@dune-project.org Date: Tue, 23 Dec 2014 11:33:32 +0100 Subject: [PATCH] FindLATEX: Add components handling --- Modules/FindLATEX.cmake | 78 + 1 file changed, 72 insertions(+), 6 deletions(-) diff --git a/Modules/FindLATEX.cmake b/Modules/FindLATEX.cmake index a935f00..28a7247 100644 --- a/Modules/FindLATEX.cmake +++ b/Modules/FindLATEX.cmake @@ -6,17 +6,42 @@ # # This module finds an installed Latex and determines the location # of the compiler. Additionally the module looks for Latex-related -# software like BibTeX. This code sets the following variables: +# software like BibTeX. +# +# This module sets the following result variables: # # :: # +# LATEX_FOUND: whether found Latex and requested components +# LATEX_component_FOUND: whether found component # LATEX_COMPILER: path to the LaTeX compiler # PDFLATEX_COMPILER:path to the PdfLaTeX compiler # BIBTEX_COMPILER: path to the BibTeX compiler # MAKEINDEX_COMPILER: path to the MakeIndex compiler # DVIPS_CONVERTER: path to the DVIPS converter +# DVIPDF_CONVERTER: path to the DVIPDF converter # PS2PDF_CONVERTER: path to the PS2PDF converter # LATEX2HTML_CONVERTER: path to the LaTeX2Html converter +# +# Possible components are: +# +# :: +# +# PDFLATEX +# BIBTEX +# MAKEINDEX +# DVIPS +# DVIPDF +# PS2PDF +# LATEX2HTML +# +# Example Usages: +# +# :: +# +# find_package(LATEX) +# find_package(LATEX COMPONENTS PDFLATEX) +# find_package(LATEX COMPONENTS BIBTEX PS2PDF) #= # Copyright 2002-2014 Kitware, Inc. @@ -32,9 +57,7 @@ # License text for the above reference.) if (WIN32) - # Try to find the MikTex binary path (look for its package manager). - find_path(MIKTEX_BINARY_PATH mpm.exe [HKEY_LOCAL_MACHINE\\SOFTWARE\\MiK\\MiKTeX\\CurrentVersion\\MiKTeX;Install Root]/miktex/bin DOC @@ -43,7 +66,6 @@ if (WIN32) mark_as_advanced(MIKTEX_BINARY_PATH) # Try to find the GhostScript binary path (look for gswin32). - get_filename_component(GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_8_00 [HKEY_LOCAL_MACHINE\\SOFTWARE\\AFPL Ghostscript\\8.00;GS_DLL] PATH ) @@ -64,45 +86,76 @@ if (WIN32) DOC Path to the GhostScript library directory. ) mark_as_advanced(GHOSTSCRIPT_LIBRARY_PATH) - endif () +# try to find Latex and the related programs find_program(LATEX_COMPILER NAMES latex PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +# find pdflatex find_program(PDFLATEX_COMPILER NAMES pdflatex PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +if (PDFLATEX_COMPILER) + set(LATEX_PDFLATEX_FOUND TRUE) +else() + set(LATEX_PDFLATEX_FOUND FALSE) +endif() +# find bibtex find_program(BIBTEX_COMPILER NAMES bibtex PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +if (BIBTEX_COMPILER) + set(LATEX_BIBTEX_FOUND TRUE) +else() + set(LATEX_BIBTEX_FOUND FALSE) +endif() +# find makeindex find_program(MAKEINDEX_COMPILER NAMES makeindex PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +if (MAKEINDEX_COMPILER) +# set(LATEX_MAKEINDEX_FOUND TRUE) +else() + set(LATEX_MAKEINDEX_FOUND FALSE) +endif() +# find dvips find_program(DVIPS_CONVERTER NAMES dvips PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +if (DVIPS_CONVERTER) + set(LATEX_DVIPS_FOUND TRUE) +else() + set(LATEX_DVIPS_FOUND FALSE) +endif() +# find dvipdf find_program(DVIPDF_CONVERTER NAMES dvipdfm dvipdft dvipdf PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +if (DVIPDF_CONVERTER) + set(LATEX_DVIPDF_FOUND TRUE) +else() + set(LATEX_DVIPDF_FOUND FALSE) +endif() +# find ps2pdf if (WIN32) find_program(PS2PDF_CONVERTER NAMES ps2pdf14.bat ps2pdf14 ps2pdf @@ -114,12 +167,23 @@ else () NAMES ps2pdf14 ps2pdf ) endif () +if (PS2PDF_CONVERTER) + set(LATEX_PS2PDF_FOUND TRUE) +else() + set(LATEX_PS2PDF_FOUND FALSE) +endif() +# find latex2html find_program(LATEX2HTML_CONVERTER NAMES latex2html PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +if (LATEX2HTML_CONVERTER) + set(LATEX_LATEX2HTML_FOUND TRUE) +else() + set(LATEX_LATEX2HTML_FOUND FALSE) +endif() mark_as_advanced( @@ -133,7 +197,9 @@ mark_as_advanced( LATEX2HTML_CONVERTER ) +# handle variables for found Latex and its components include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -find_package_handle_standard_args(Latex +find_package_handle_standard_args(LATEX REQUIRED_VARS LATEX_COMPILER + HANDLE_COMPONENTS ) -- 2.1.2 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more
Re: [cmake-developers] Which binaries should be required in FindLATEX?
On 12/23/2014 05:35 AM, Christoph Grüninger wrote: next try and as always better than the last attempt. Applied: FindLATEX: Add components handling http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=07a3f9ad with minor documentation tweaks and one logic fix: -# set(LATEX_MAKEINDEX_FOUND TRUE) + set(LATEX_MAKEINDEX_FOUND TRUE) that looked left from local testing. Thanks, -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] Which binaries should be required in FindLATEX?
On 12/22/2014 02:44 AM, Christoph Grüninger wrote: please find attached a patch that introduces components handling for optional LaTeX executable. Thanks for working on this. Maybe we should deprecate the old variables name? The names should not be changed at all. They become cache entries that people may be setting in their scripts on the command line, or have set in existing build trees. Also the names are visible to the human in cmake-gui so calling them ..._FOUND does not make sense. The FPHSA component handling still leaves it to the module code to specify whether each component was found. Therefore you should just use a pattern like this: find_program(LATEX2HTML_CONVERTER ...) if (LATEX2HTML_CONVERTER) set(LATEX_LATEX2HTML_FOUND 1) else() set(LATEX_LATEX2HTML_FOUND 0) endif() Once you have that explicit mapping then you can optionally use lower-case component names. I have no strong preference on that though. Thanks, -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] Which binaries should be required in FindLATEX?
Hi Brad, please find attached a new patch following your latest suggestions. Once you have that explicit mapping then you can optionally use lower-case component names. I have no strong preference on that though. I'd like to have lower case components but I dislike mixed-cased variable names. The latter feeling is stronger. Wish you nice holidays, Christoph From 66b20975b29af82d2f561e9324c53fed717311a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= gruen...@dune-project.org Date: Tue, 23 Dec 2014 00:24:04 +0100 Subject: [PATCH] FindLATEX: Add components handling --- Modules/FindLATEX.cmake | 85 + 1 file changed, 79 insertions(+), 6 deletions(-) diff --git a/Modules/FindLATEX.cmake b/Modules/FindLATEX.cmake index a935f00..954f8f7 100644 --- a/Modules/FindLATEX.cmake +++ b/Modules/FindLATEX.cmake @@ -6,17 +6,42 @@ # # This module finds an installed Latex and determines the location # of the compiler. Additionally the module looks for Latex-related -# software like BibTeX. This code sets the following variables: +# software like BibTeX. +# +# This module sets the following result variables: # # :: # +# LATEX_FOUND: whether found Latex and requested components +# LATEX_component_FOUND: whether found component # LATEX_COMPILER: path to the LaTeX compiler # PDFLATEX_COMPILER:path to the PdfLaTeX compiler # BIBTEX_COMPILER: path to the BibTeX compiler # MAKEINDEX_COMPILER: path to the MakeIndex compiler # DVIPS_CONVERTER: path to the DVIPS converter +# DVIPDF_CONVERTER: path to the DVIPDF converter # PS2PDF_CONVERTER: path to the PS2PDF converter # LATEX2HTML_CONVERTER: path to the LaTeX2Html converter +# +# Possible components are: +# +# :: +# +# PDFLATEX +# BIBTEX +# MAKEINDEX +# DVIPS +# DVIPDF +# PS2PDF +# LATEX2HTML +# +# Example Usages: +# +# :: +# +# find_package(LATEX) +# find_package(LATEX COMPONENTS PDFLATEX) +# find_package(LATEX COMPONENTS BIBTEX PS2PDF) #= # Copyright 2002-2014 Kitware, Inc. @@ -32,9 +57,7 @@ # License text for the above reference.) if (WIN32) - # Try to find the MikTex binary path (look for its package manager). - find_path(MIKTEX_BINARY_PATH mpm.exe [HKEY_LOCAL_MACHINE\\SOFTWARE\\MiK\\MiKTeX\\CurrentVersion\\MiKTeX;Install Root]/miktex/bin DOC @@ -43,7 +66,6 @@ if (WIN32) mark_as_advanced(MIKTEX_BINARY_PATH) # Try to find the GhostScript binary path (look for gswin32). - get_filename_component(GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_8_00 [HKEY_LOCAL_MACHINE\\SOFTWARE\\AFPL Ghostscript\\8.00;GS_DLL] PATH ) @@ -64,45 +86,76 @@ if (WIN32) DOC Path to the GhostScript library directory. ) mark_as_advanced(GHOSTSCRIPT_LIBRARY_PATH) - endif () +# try to find Latex and the related programs find_program(LATEX_COMPILER NAMES latex PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +# find pdflatex find_program(PDFLATEX_COMPILER NAMES pdflatex PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +if (PDFLATEX_COMPILER) + set(LATEX_PDFLATEX_FOUND TRUE) +else() + set(LATEX_PDFLATEX_FOUND FALSE) +endif() +# find bibtex find_program(BIBTEX_COMPILER NAMES bibtex PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +if (BIBTEX_COMPILER) + set(LATEX_BIBTEX_FOUND TRUE) +else() + set(LATEX_BIBTEX_FOUND FALSE) +endif() +# find makeindex find_program(MAKEINDEX_COMPILER NAMES makeindex PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +if (MAKEINDEX_COMPILER) +# set(LATEX_MAKEINDEX_FOUND TRUE) +else() + set(LATEX_MAKEINDEX_FOUND FALSE) +endif() +# find dvips find_program(DVIPS_CONVERTER NAMES dvips PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +if (DVIPS_CONVERTER) + set(LATEX_DVIPS_FOUND TRUE) +else() + set(LATEX_DVIPS_FOUND FALSE) +endif() +# find dvipdf find_program(DVIPDF_CONVERTER NAMES dvipdfm dvipdft dvipdf PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +if (DVIPDF_CONVERTER) + set(LATEX_DVIPDF_FOUND TRUE) +else() + set(LATEX_DVIPDF_FOUND FALSE) +endif() +# find ps2pdf if (WIN32) find_program(PS2PDF_CONVERTER NAMES ps2pdf14.bat ps2pdf14 ps2pdf @@ -114,26 +167,46 @@ else () NAMES ps2pdf14 ps2pdf ) endif () +if (PS2PDF_CONVERTER) + set(LATEX_PS2PDF_FOUND TRUE) +else() + set(LATEX_PS2PDF_FOUND FALSE) +endif() +# find latex2html find_program(LATEX2HTML_CONVERTER NAMES latex2html PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +if (LATEX2HTML_CONVERTER) + set(LATEX_LATEX2HTML_FOUND TRUE) +else() + set(LATEX_LATEX2HTML_FOUND FALSE) +endif() mark_as_advanced( LATEX_COMPILER PDFLATEX_COMPILER + LATEX_PDFLATEX_FOUND BIBTEX_COMPILER + LATEX_BIBTEX_FOUND MAKEINDEX_COMPILER + LATEX_MAKEINDEX_FOUND DVIPS_CONVERTER + LATEX_DVIPS_FOUND DVIPDF_CONVERTER + LATEX_DVIPDF_FOUND PS2PDF_CONVERTER +
Re: [cmake-developers] Which binaries should be required in FindLATEX?
Hi Brad, please find attached a patch that introduces components handling for optional LaTeX executable. FPHSA's components handling feature is pretty cool. I first wrote the components handling myself, but the built-in version is more elegant. I am the first one to use this feature in an official test. Yeah! Maybe we should deprecate the old variables name? I don't know and its not a big deal to keep them. Bye and thanks for your constructive feedback, Christoph From 9dee2386ba4399c326df47e9e40ab308c28d43d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= gruen...@dune-project.org Date: Mon, 22 Dec 2014 08:37:34 +0100 Subject: [PATCH] FindLATEX: Add components handling --- Modules/FindLATEX.cmake | 60 - 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/Modules/FindLATEX.cmake b/Modules/FindLATEX.cmake index a935f00..db97a61 100644 --- a/Modules/FindLATEX.cmake +++ b/Modules/FindLATEX.cmake @@ -6,17 +6,42 @@ # # This module finds an installed Latex and determines the location # of the compiler. Additionally the module looks for Latex-related -# software like BibTeX. This code sets the following variables: +# software like BibTeX. +# +# This module sets the following result variables: # # :: # +# LATEX_FOUND: whether found Latex and requested components +# LATEX_component_FOUND: whether found component # LATEX_COMPILER: path to the LaTeX compiler # PDFLATEX_COMPILER:path to the PdfLaTeX compiler # BIBTEX_COMPILER: path to the BibTeX compiler # MAKEINDEX_COMPILER: path to the MakeIndex compiler # DVIPS_CONVERTER: path to the DVIPS converter +# DVIPDF_CONVERTER: path to the DVIPDF converter # PS2PDF_CONVERTER: path to the PS2PDF converter # LATEX2HTML_CONVERTER: path to the LaTeX2Html converter +# +# Possible components are: +# +# :: +# +# PDFLATEX +# BIBTEX +# MAKEINDEX +# DVIPS +# DVIPDF +# PS2PDF +# LATEX2HTML +# +# Example Usages: +# +# :: +# +# find_package(LATEX) +# find_package(LATEX COMPONENTS PDFLATEX) +# find_package(LATEX COMPONENTS BIBTEX PS2PDF) #= # Copyright 2002-2014 Kitware, Inc. @@ -32,9 +57,7 @@ # License text for the above reference.) if (WIN32) - # Try to find the MikTex binary path (look for its package manager). - find_path(MIKTEX_BINARY_PATH mpm.exe [HKEY_LOCAL_MACHINE\\SOFTWARE\\MiK\\MiKTeX\\CurrentVersion\\MiKTeX;Install Root]/miktex/bin DOC @@ -43,7 +66,6 @@ if (WIN32) mark_as_advanced(MIKTEX_BINARY_PATH) # Try to find the GhostScript binary path (look for gswin32). - get_filename_component(GHOSTSCRIPT_BINARY_PATH_FROM_REGISTERY_8_00 [HKEY_LOCAL_MACHINE\\SOFTWARE\\AFPL Ghostscript\\8.00;GS_DLL] PATH ) @@ -64,63 +86,69 @@ if (WIN32) DOC Path to the GhostScript library directory. ) mark_as_advanced(GHOSTSCRIPT_LIBRARY_PATH) - endif () +# try to find Latex and the related programs find_program(LATEX_COMPILER NAMES latex PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) -find_program(PDFLATEX_COMPILER +find_program(LATEX_PDFLATEX_FOUND NAMES pdflatex PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +set(PDFLATEX_COMPILER LATEX_PDFLATEX_FOUND) -find_program(BIBTEX_COMPILER +find_program(LATEX_BIBTEX_FOUND NAMES bibtex PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +set(BIBTEX_COMPILER LATEX_BIBTEX_FOUND) -find_program(MAKEINDEX_COMPILER +find_program(LATEX_MAKEINDEX_FOUND NAMES makeindex PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +set(MAKEINDEX_COMPILER LATEX_MAKEINDEX_FOUND) -find_program(DVIPS_CONVERTER +find_program(LATEX_DVIPS_FOUND NAMES dvips PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +set(DVIPS_CONVERTER LATEX_DVIPS_FOUND) -find_program(DVIPDF_CONVERTER +find_program(LATEX_DVIPDF_FOUND NAMES dvipdfm dvipdft dvipdf PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) +set(DVIPDF_CONVERTER LATEX_DVIPDF_FOUND) if (WIN32) - find_program(PS2PDF_CONVERTER + find_program(LATEX_PS2PDF_FOUND NAMES ps2pdf14.bat ps2pdf14 ps2pdf PATHS ${GHOSTSCRIPT_LIBRARY_PATH} ${MIKTEX_BINARY_PATH} ) else () - find_program(PS2PDF_CONVERTER + find_program(LATEX_PS2PDF_FOUND NAMES ps2pdf14 ps2pdf ) endif () +set(PS2PDF_CONVERTER LATEX_PS2PDF_FOUND) -find_program(LATEX2HTML_CONVERTER +find_program(LATEX_LATEX2HTML_FOUND NAMES latex2html PATHS ${MIKTEX_BINARY_PATH} /usr/bin ) - +set(LATEX2HTML_CONVERTER LATEX_LATEX2HTML_FOUND) mark_as_advanced( LATEX_COMPILER @@ -133,7 +161,9 @@ mark_as_advanced( LATEX2HTML_CONVERTER ) +# handle variables for found Latex and its components include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -find_package_handle_standard_args(Latex +find_package_handle_standard_args(LATEX REQUIRED_VARS LATEX_COMPILER + HANDLE_COMPONENTS )
Re: [cmake-developers] Which binaries should be required in FindLATEX?
Hi Christoph, Thanks for working on this. On 12/05/2014 02:35 AM, Christoph Grüninger wrote: For users it would be great to simply have all these binaries. I don't have all the converters installed but can still build PDF books. The varying tools do not all come in the same package on Linux distros. Of course most projects will want most or all of the tools. For this I think the FindLATEX module should implement support for the find_package COMPONENTS option. Then projects can specify what they need: find_package(LATEX COMPONENTS latex pdflatex bibtex ...) and the module will compute the proper LATEX_FOUND value based on the availability of all the requested components. If this is still to restrictive, I propose to only test for the LaTeX compiler and let the user check for the other binaries (with if(MAKEINDEX_COMPILER) ) With proper component support I think that proposal makes sense. If no components are listed then LATEX_FOUND should be based only on LATEX_COMPILER. If components are listed then all of them must be found. Of course this approach can be implemented first to get FPHSA working and component support added later. Any components listed would just be added to the list given to the REQUIRED_VARS option of FPHSA. In any case, I'll have to clarify this in the documentation for my next patch. In the next revision please also add your name to the author field instead of the Github user id. Thanks, -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers