project(presentation LANGUAGES NONE) cmake_minimum_required(VERSION 3.5) # ------------------------------------ set(jobname "cmake-workshop-20190729") set(output "${jobname}.pdf") set(mainsource "main.tex") set(sources ${mainsource} cmake-for-scripting.tex cross-compilation-toolchains.tex feature-platform-check.tex outro.tex preamble.tex project-handling.tex rpath-build-install-tree.tex starting-from-today.tex troubleshooting.tex usage-of-targets.tex) file(GLOB images "images/*") list(APPEND sources ${images}) # ------------------------------------ find_program(XETEX NAMES xetex) if(NOT XETEX) message(FATAL_ERROR "Please install xetex") endif() find_program(RUBBER NAMES rubber) if(NOT RUBBER) message(FATAL_ERROR "Please install rubber") endif() find_program(PYGMENTS NAMES pygmentize) if(NOT PYGMENTS) message(FATAL_ERROR "Please install python3-pygments") endif() add_custom_command(OUTPUT ${output} COMMAND ${RUBBER} --unsafe --pdf --module xelatex --module beamer --module shell_escape --into ${CMAKE_CURRENT_BINARY_DIR} --jobname "${jobname}" "${CMAKE_CURRENT_SOURCE_DIR}/${mainsource}" MAIN_DEPENDENCY ${mainsource} DEPENDS ${sources} BYPRODUCTS ${jobname}.aux ${jobname}.nav ${jobname}.toc ${jobname}.log ${jobname}.out ${jobname}.snm COMMENT "Generating pdf file for the presentation" VERBATIM) add_custom_target(presentation ALL DEPENDS ${output})