Skip to content
Snippets Groups Projects
Commit ef5b44db authored by Markus Blatt's avatar Markus Blatt
Browse files

Honor pdf documentation distributed with autotools tarballs.

The tarballs already contain the generated pdf files. No CMake 
will detect whether the pdf are contained in the source tree.
If that is the case they will not be generated and installed directly.

[[Imported from SVN: r7380]]
parent 293c928b
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,7 @@
# If DEPENDENCY is specified, this is a dependency for
# the installation. Otherwise FILENAME becomes the dependency
#
# dune_add_latex_document()
FIND_PACKAGE(LATEX)
FIND_PROGRAM(IMAGEMAGICK_CONVERT convert
......@@ -50,7 +51,14 @@ add_custom_target(doc)
MACRO(create_doc_install filename targetdir)
dune_common_script_dir(SCRIPT_DIR)
get_filename_component(targetfile ${filename} NAME)
set(install_command ${CMAKE_COMMAND} -D FILES=${filename} -D DIR=${CMAKE_INSTALL_PREFIX}/${targetdir} -P ${SCRIPT_DIR}/InstallFile.cmake)
# The doc file might be in CMAKE_CURRENT_<SOURCE|BINARY>_DIR
# Depending on whether this is a tarball or not
set(_src_file _src_file-NOTFOUND)
find_file(_src_file ${targetfile} ${CMAKE_CURRENT_SOURCE_DIR})
if(NOT _src_file)
set(_src_file ${filename})
endif(NOT _src_file)
set(install_command ${CMAKE_COMMAND} -D FILES=${_src_file} -D DIR=${CMAKE_INSTALL_PREFIX}/${targetdir} -P ${SCRIPT_DIR}/InstallFile.cmake)
# create a custom target for the installation
if("${ARGC}" EQUAL "3")
set(_depends ${ARGV2})
......@@ -65,5 +73,20 @@ MACRO(create_doc_install filename targetdir)
LIST(APPEND CMAKE_INSTALL_MANIFEST_FILES ${CMAKE_INSTALL_PREFIX}/${targetdir}/${targetfile})")
ENDMACRO(create_doc_install)
MACRO(dune_add_latex_document tex_file)
# We assume that we always generate a PDF file.
# If the corresponding pdf file already exists in the source tree
# we do not add a rule to build it.
string(REGEX REPLACE "(.+).tex" "\\1.pdf" file ${tex_file})
string(REGEX REPLACE "/" "_" "${CMAKE_CURRENT_SOURCE_DIR}/${file}" filevar ${file})
set(filevar "filevar-NOTFOUND")
find_file(filevar ${file} ${CMAKE_CURRENT_SOURCE_DIR})
if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR} OR NOT filevar)
# add rule to create latex document
dune_add_latex_document(tex_file ${ARGN})
endif(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR} OR NOT filevar)
ENDMACRO(dune_add_latex_document tex_file)
# Support building documentation with doxygen.
include(DuneDoxygen)
if(LATEX_USABLE)
ADD_LATEX_DOCUMENT(buildsystem.tex FATHER_TARGET doc DEFAULT_PDF INPUTS ../Makefile.am ../../configure.ac ../example.opts)
dune_add_latex_document(buildsystem.tex FATHER_TARGET doc DEFAULT_PDF INPUTS ../Makefile.am ../../configure.ac ../example.opts)
create_doc_install(${CMAKE_CURRENT_BINARY_DIR}/buildsystem.pdf ${CMAKE_INSTALL_DOCDIR}/buildsystem)
endif(LATEX_USABLE)
......@@ -6,7 +6,7 @@ add_executable(indexset "indexset.cc")
target_link_libraries(indexset "dunecommon")
add_dune_mpi_flags("poosc08;poosc08_test;indexset")
if(LATEX_USABLE)
ADD_LATEX_DOCUMENT(communication.tex FATHER_TARGET doc
dune_add_latex_document(communication.tex FATHER_TARGET doc
BIBFILES communication.bib DEFAULT_SAFEPDF INPUTS poosc08_test.cc
IMAGE_DIRS figures)
create_doc_install(${CMAKE_CURRENT_BINARY_DIR}/communication.pdf ${CMAKE_INSTALL_DOCDIR}/comm communication_safepdf)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment