Created
January 15, 2018 16:22
-
-
Save artivis/d760111185139101b7c3c78f59db84df to your computer and use it in GitHub Desktop.
Latex + Cmake
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 2.8.4) | |
project(my_latex_report NONE) | |
include(UseLatex.cmake) | |
UseLatex() | |
add_latex_document(my_latex_report.tex | |
INPUTS Introduction.tex | |
BIBFILES references.bib | |
# IMAGE_DIRS images | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tiny dummy function to find/download ' UseLATEX.cmake '. | |
# All credits to kmorel : https://github.com/kmorel/UseLATEX | |
function(UseLatex) | |
set(USE_LATEX_FILE "UseLATEX.cmake") | |
if (${ARGC} GREATER 0) | |
set(USE_LATEX_PATH ${ARGV0}) | |
else() | |
set(USE_LATEX_PATH "/tmp/") | |
endif() | |
find_file(FF_USE_LATEX ${USE_LATEX_FILE} HINTS ${USE_LATEX_PATH}) | |
if(FF_USE_LATEX STREQUAL "FF_USE_LATEX-NOTFOUND") | |
set(USE_LATEX_FULL_PATH "${USE_LATEX_PATH}${USE_LATEX_FILE}") | |
message("INFO : Will try to download ${USE_LATEX_FILE} at ${USE_LATEX_FULL_PATH}") | |
file(DOWNLOAD https://raw.githubusercontent.com/kmorel/UseLATEX/master/UseLATEX.cmake ${USE_LATEX_FULL_PATH} | |
INACTIVITY_TIMEOUT 10 TIMEOUT 15 STATUS UseLATEXDwStatus SHOW_PROGRESS) | |
list(GET UseLATEXDwStatus 0 UseLATEXDwStatusNotOk) | |
if (${UseLATEXDwStatusNotOk}) | |
message(FATAL_ERROR "Could not download ${USE_LATEX_FILE} !") | |
else() | |
message("INFO : Successfully dowloaded ${USE_LATEX_FILE} at ${USE_LATEX_FULL_PATH}") | |
endif() | |
else() | |
set(USE_LATEX_FULL_PATH "${FF_USE_LATEX}") | |
message("INFO : found ${USE_LATEX_FILE} at ${USE_LATEX_FULL_PATH}") | |
endif() | |
include(${USE_LATEX_FULL_PATH}) | |
endfunction(UseLatex) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment