Anonymous - 2012-04-26

Dear Kile users,

I made some years ago my own cmake project for compiling latex document and I
also use Kile for a while for editing the document. Since now, I was compiling
my project in a console. I would like to know if it is possible to use kile to
debug.

I defined a custom tool but I am a bit puzzled at that point. Should I define
my tool as inheriting pdflatex? (with cmake it is possible to use pdflatex)?

Here is my CMakeLists.txt in the main directory

CMAKE_MINIMUM_REQUIRED(VERSION 2.4)

if(COMMAND cmake_policy)

policy settings ...

cmake_policy(SET CMP0012 NEW)

endif(COMMAND cmake_policy)

PROJECT(RR_BASE NONE)

MACRO(REMOVE_FROM_LIST var_name list1 list2)

Remove elements in list2 from list1 and store the result in var_name.

To pass a list stored in variable x, do not forget to double quote

the variable like in: "${x}"

SET(filter_tmp "")

FOREACH(l ${list1})

IF(NOT "${list2}" MATCHES "(^|;)${l}(;|$)")

SET(filter_tmp ${filter_tmp} ${l})

ENDIF(NOT "${list2}" MATCHES "(^|;)${l}(;|$)")

ENDFOREACH(l)

SET(${var_name} ${filter_tmp})

ENDMACRO(REMOVE_FROM_LIST)

MACRO( APPEND_TO_LIST var_name rep list1 )

APPEND var_name to all the elements of list1

To pass a list stored in variable x, do not forget to double quote

the variable like in: "${x}"

SET(filter_tmp "")

FOREACH(l ${list1})

SET(filter_tmp ${filter_tmp} ${rep}/${l})

ENDFOREACH(l)

SET(${var_name} ${filter_tmp})

ENDMACRO(APPEND_TO_LIST)

set( MAIN_TEX linearAlgebra.tex )

set( OTHER_FILES )

Add here all the image repositories

set( IMG_DIRS img/logos img/theorem )

set( BIB_ENTRY TRUE )

set( F_BASE_DIR ${PROJECT_SOURCE_DIR} )

add_subdirectory(latex)

and here is the one used in the latex subdirectory

INCLUDE( ${F_BASE_DIR}/CMake/UseLATEX.cmake )

CMAKE_MINIMUM_REQUIRED(VERSION 2.4)

if(COMMAND cmake_policy)

policy settings ...

cmake_policy(SET CMP0012 NEW)

endif(COMMAND cmake_policy)

PROJECT(F NONE)

set( LATEX_OUTPUT_PATH ${F_BASE_DIR}/out )

set( EXECUTABLE_OUTPUT_PATH ${F_BASE_DIR}/out)

APPEND_TO_LIST( FULL_IMG_DIRS .. "${IMG_DIRS}" )

APPEND_TO_LIST( FULL_OTHER_FILES .. "${OTHER_FILES}" )

F I N D L A T E X F I L E S

set( F_tex ${MAIN_TEX} )

file( GLOB F_src RELATIVE ${PROJECT_SOURCE_DIR} ?*.tex )

file( GLOB F_sty RELATIVE ${PROJECT_SOURCE_DIR} ?*.sty )

file( GLOB F_bib RELATIVE ${PROJECT_SOURCE_DIR} ?*.bib )

REMOVE_FROM_LIST( F_tex_input "${F_src}" ${F_tex} )

set( F_tex_input ${F_tex_input} ${F_sty} ${FULL_OTHER_FILES} )

IF( ${BIB_ENTRY} )

ADD_LATEX_DOCUMENT( ${F_tex}

INPUTS ${F_tex_input}

BIBFILES ${F_bib}

IMAGE_DIRS ${FULL_IMG_DIRS}

USE_INDEX

DEFAULT_PDF )

ELSE( ${BIB_ENTRY} )

ADD_LATEX_DOCUMENT( ${F_tex}

INPUTS ${F_tex_input}

IMAGE_DIRS ${FULL_IMG_DIRS}

USE_INDEX

DEFAULT_PDF )

ENDIF( ${BIB_ENTRY} )

set( copy_output_name "Copy output in out directory" )

ADD_CUSTOM_TARGET( ${copy_output_name} ALL

${CMAKE_COMMAND} -E make_directory ${F_BASE_DIR}/out

COMMAND ${CMAKE_COMMAND} -E copy ${output_dir}/${LATEX_TARGET}.pdf
${F_BASE_DIR}/out/

DEPENDS ${LATEX_TARGET}.pdf

COMMENT Latex_Compilation "Latex Compilation"

)

INSTALL( FILES ${output_dir}/${LATEX_TARGET}.pdf

DESTINATION ${F_BASE_DIR}/out )

Thanks in advance for the support.

  • all the best,

MY