Minimal Cmake Pdf =link= | 2025-2026 |
No external scripts, no complicated add_custom_command chaining – just one call to pdflatex . Example 2: Minimal PDF from Markdown (using Pandoc) When your source is Markdown and you want a PDF via LaTeX:
find_package(LATEX QUIET) if(NOT LATEX_FOUND) message(STATUS "PDF generation disabled (pdflatex not found)") else() # ... add_custom_command and add_custom_target as above endif() This preserves the minimal philosophy: no hard failures, just feature detection. | Aspect | Minimal CMake Approach | |--------|------------------------| | Tooling | find_package(LATEX) or find_program(PANDOC) | | Build step | One add_custom_command | | User interface | One add_custom_target(pdf) | | External dependencies | None (CMake only) | | Complexity | ~10 lines of CMake | minimal cmake pdf
add_custom_target(pdf DEPENDS $PDF_OUTPUT) Sometimes you want the PDF content to reflect CMake variables (e.g., version number). With minimal CMake, you can generate a .tex or .md file first: version number). With minimal CMake