ClhepBuildTex.cmake 1.67 KB
Newer Older
1
2
3
4
5
6
7
8
# run latex 

# clhep_latex( package main_tex_file [other tex or sty files to include] )

# for documentation
FIND_PACKAGE(LATEX)

macro( clhep_latex package main_tex_file )
Lynn Garren's avatar
Lynn Garren committed
9
IF(PDFLATEX_COMPILER)
10
11
12
13
14
15
16
17
   FOREACH(arg ${ARGN})  
     CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/${arg} 
                     ${CMAKE_CURRENT_BINARY_DIR}/${arg}  COPYONLY)
     set( depend_list ${arg} ${depend_list} )
   ENDFOREACH(arg) 
   ##message(STATUS "${package} ${main_tex_file} depends on ${depend_list}" )
   ADD_CUSTOM_COMMAND( 
    OUTPUT    ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.aux
Lynn Garren's avatar
Lynn Garren committed
18
    COMMAND   ${PDFLATEX_COMPILER}
Lynn Garren's avatar
Lynn Garren committed
19
              -interaction=batchmode ${CMAKE_CURRENT_SOURCE_DIR}/${main_tex_file}
20
21
22
23
    DEPENDS   ${CMAKE_CURRENT_SOURCE_DIR}/${main_tex_file}.tex ${depend_list}
    COMMENT   "Latex - first pass"
  )
   ADD_CUSTOM_COMMAND( 
Lynn Garren's avatar
Lynn Garren committed
24
25
    OUTPUT    ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.log
    COMMAND   ${PDFLATEX_COMPILER}
Lynn Garren's avatar
Lynn Garren committed
26
              -interaction=batchmode ${CMAKE_CURRENT_SOURCE_DIR}/${main_tex_file}
27
28
29
30
    DEPENDS   ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.aux
    COMMENT   "Latex - second pass"
  )
   ADD_CUSTOM_COMMAND( 
Lynn Garren's avatar
Lynn Garren committed
31
32
    OUTPUT    ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.pdf
    COMMAND   ${PDFLATEX_COMPILER}
Lynn Garren's avatar
Lynn Garren committed
33
              -interaction=batchmode ${CMAKE_CURRENT_SOURCE_DIR}/${main_tex_file}
Lynn Garren's avatar
Lynn Garren committed
34
    DEPENDS   ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.log
35
36
37
    COMMENT   "Latex - third pass"
  )
  ADD_CUSTOM_TARGET(${main_tex_file} ALL echo
Lynn Garren's avatar
Lynn Garren committed
38
    DEPENDS   ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.pdf
39
    )
40
41

 INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${main_tex_file}.pdf
42
          DESTINATION share/doc/CLHEP/${package} )
Lynn Garren's avatar
Lynn Garren committed
43
ENDIF(PDFLATEX_COMPILER)
44
45

endmacro( clhep_latex )