[CMake] Out of source latex build

Moreland, Kenneth kmorel at sandia.gov
Mon Oct 26 10:13:36 EDT 2009


Consider using the UseLATEX.cmake collection of macros.  It supports out-of-source builds (in fact, sort of enforces them) and handles copying .sty files as well as all sorts of other sticky little issues with building LaTeX files.  You can the macros and the documentation for them on this Wiki page:

http://www.cmake.org/Wiki/CMakeUserUseLATEX

-Ken


On 10/26/09 7:46 AM, "christophe laferriere" <christophe.laferriere at gmail.com> wrote:

Hi All,

I'm trying to add a rules to my latex build (included in a bigger
project) so that a .sty file is copied in the current_binary_dir.
I've tried several things but can't get the .sty file copied in the
build directory, latex complain about it when i try "make".
Any help would be appreciate!

Here is my CMakeLists.txt :

FIND_PACKAGE(LATEX)

set (STY "dot2texi.sty")

# should copy the .sty file to the current binary dir
ADD_CUSTOM_COMMAND(
   TARGET copy_sty
    POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/$
{STY} ${CMAKE_CURRENT_BINARY_DIR}/${STY}
    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${STY}
)

# does compile the .tex file in current binary dir
IF(LATEX_COMPILER)
   ADD_CUSTOM_COMMAND(
     OUTPUT    ${CMAKE_CURRENT_BINARY_DIR}/specs.dvi
     COMMAND   ${LATEX_COMPILER}
     ARGS      ${CMAKE_CURRENT_SOURCE_DIR}/specs.tex
     DEPENDS   ${CMAKE_CURRENT_SOURCE_DIR}/specs.tex
     COMMENT   "Tex2dvi"
   )
   IF(DVIPS_CONVERTER)
     ADD_CUSTOM_COMMAND(
       OUTPUT    ${CMAKE_CURRENT_BINARY_DIR}/specs.ps
       COMMAND   ${DVIPS_CONVERTER}
       ARGS      ${CMAKE_CURRENT_BINARY_DIR}/specs.dvi
                 -o ${CMAKE_CURRENT_BINARY_DIR}/specs.ps
       DEPENDS   ${CMAKE_CURRENT_BINARY_DIR}/specs.dvi
       COMMENT   "dvi2ps"
    )

  IF(PS2PDF_CONVERTER)
     ADD_CUSTOM_COMMAND(
       OUTPUT    ${CMAKE_CURRENT_BINARY_DIR}/specs.pdf
       COMMAND   ${PS2PDF_CONVERTER}
       ARGS      ${CMAKE_CURRENT_BINARY_DIR}/specs.ps
       DEPENDS   ${CMAKE_CURRENT_BINARY_DIR}/specs.ps
       COMMENT   "ps2pdf"
     )
     ADD_CUSTOM_TARGET(LaTeXDocument ALL echo
       DEPENDS   ${CMAKE_CURRENT_BINARY_DIR}/specs.pdf
     )
     ENDIF(PS2PDF_CONVERTER)
   ENDIF(DVIPS_CONVERTER)
ENDIF(LATEX_COMPILER)

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake




   ****      Kenneth Moreland
    ***      Sandia National Laboratories
***********
*** *** ***  email: kmorel at sandia.gov
**  ***  **  phone: (505) 844-8919
    ***      web:   http://www.cs.unm.edu/~kmorel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091026/6244bc16/attachment.htm>


More information about the CMake mailing list