-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathAddPdfTarget.cmake
39 lines (30 loc) · 1.49 KB
/
AddPdfTarget.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function (add_pdf_target targetbase lang entities figures xslt_file)
set(docname "gnucash-${targetbase}")
set(fofile "${docname}.fo")
set(pdffile "${docname}.pdf")
set(BUILD_DIR "${DOCDIR_BUILD}/${lang}")
if (NOT IS_ABSOLUTE ${xslt_file})
set(xslt_file "${CMAKE_CURRENT_SOURCE_DIR}/${xslt_file}")
endif()
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${fofile}"
COMMAND ${CMAKE_COMMAND} -E make_directory "${BUILD_DIR}"
COMMAND ${XSLTPROC} ${XSLTPROCFLAGS} ${XSLTPROCFLAGS_FO}
-o "${CMAKE_CURRENT_BINARY_DIR}/${fofile}"
--stringparam gnc.lang ${lang}
"${xslt_file}"
"${CMAKE_CURRENT_SOURCE_DIR}/index.docbook"
DEPENDS ${entities} "index.docbook" "${CMAKE_SOURCE_DIR}/docbook/gnc-docbookx.dtd")
configure_file("${FOP_XCONF}" "${CMAKE_CURRENT_BINARY_DIR}/fop.xconf")
add_custom_command(
OUTPUT "${BUILD_DIR}/${pdffile}"
COMMAND ${FOP} ${FOPFLAGS}
-l ${lang}
-c "${CMAKE_CURRENT_BINARY_DIR}/fop.xconf"
-fo "${CMAKE_CURRENT_BINARY_DIR}/${fofile}"
-pdf "${BUILD_DIR}/${pdffile}"
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${fofile}" ${figures})
add_custom_target("${lang}-${targetbase}-pdf"
DEPENDS "${BUILD_DIR}/${pdffile}")
add_dependencies(${lang}-pdf "${lang}-${targetbase}-pdf")
endfunction()