Skip to content
Snippets Groups Projects
Commit 4c60c81f authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Improve cmake scripts to find required utilities

- to build html doc, one requires emacs and gnuplot
- to build pdf doc, one requires additionally pdflatex and pygmentize
parent 42357f79
No related branches found
No related tags found
1 merge request!156Improve cmake scripts to find required utilities
......@@ -669,6 +669,8 @@ else()
endif()
endif()
message("----------- utilities ----------")
if(CLANG_FORMAT)
message(" clang-format: ${CLANG_FORMAT}")
else()
......@@ -693,5 +695,41 @@ else()
message(" emacs: not found!")
endif()
if (GNUPLOT_FOUND)
message(" gnuplot: ${GNUPLOT}")
else()
message(" gnuplot: not found!")
endif()
if (PYGMENTIZE)
message(" pygmentize: ${PYGMENTIZE}")
else()
message(" pygmentize: not found!")
endif()
if (LATEX_PDFLATEX_FOUND)
message(" pdflatex: ${PDFLATEX_COMPILER}")
else()
message(" pdflatex: not found!")
endif()
if (NOT EMACS OR NOT GNUPLOT_FOUND)
message(" ** Cannot build documentation: missing ")
elseif(NOT LATEX_PDFLATEX_FOUND OR NOT PYGMENTIZE)
message(" ** Cannot build pdf documentation: missing")
endif()
if (NOT EMACS)
message(" - emacs")
endif()
if (NOT GNUPLOT_FOUND)
message(" - gnuplot")
endif()
if (NOT LATEX_PDFLATEX_FOUND)
message(" - pdflatex")
endif()
if (NOT PYGMENTIZE)
message(" - pygmentize")
endif()
message("================================")
message("")
......@@ -6,10 +6,16 @@ find_program(EMACS emacs)
# check for LaTeX
find_package(LATEX COMPONENTS PDFLATEX)
# check for pygmentize
find_program(PYGMENTIZE pygmentize)
# check for gnuplot
find_package(Gnuplot)
add_custom_target(userdoc)
add_custom_target(doc DEPENDS userdoc)
if (EMACS)
if (EMACS AND GNUPLOT_FOUND)
add_custom_command(
OUTPUT "${PUGS_BINARY_DIR}/doc"
......@@ -64,7 +70,7 @@ if (EMACS)
add_dependencies(userdoc userdoc-html)
if (LATEX_FOUND)
if (LATEX_PDFLATEX_FOUND AND PYGMENTIZE)
add_custom_command(
OUTPUT "${PUGS_BINARY_DIR}/doc/userdoc.pdf"
......@@ -92,7 +98,37 @@ if (EMACS)
add_dependencies(userdoc userdoc-pdf)
else()
if (NOT LATEX_PDFLATEX_FOUND)
add_custom_target(userdoc-missing-latex
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --no-newline "Cannot build pdf documentation: "
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red --bold "pdflatex missing")
add_dependencies(userdoc userdoc-missing-latex)
endif()
add_dependencies(doc userdoc)
if (NOT PIGMENTIZE_FOUND)
add_custom_target(userdoc-missing-pygmentize
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --no-newline "Cannot build pdf documentation: "
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red --bold "pygmentize missing")
add_dependencies(userdoc userdoc-missing-pygmentize)
endif()
endif()
else()
if (NOT EMACS)
add_custom_target(userdoc-missing-emacs
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --no-newline "Cannot build documentation: "
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red --bold "emacs missing")
add_dependencies(userdoc userdoc-missing-emacs)
endif()
if (NOT GNUPLOT_FOUND)
add_custom_target(userdoc-missing-gnuplot
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --no-newline "Cannot build documentation: "
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red --bold "gnuplot missing")
add_dependencies(userdoc userdoc-missing-gnuplot)
endif()
endif()
add_dependencies(doc userdoc)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment