blob: c333f64973a871f6f4a09eaa27ca860ad2983a4f (
plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
include(GNUInstallDirs)
include(FindDocBookXSL)
function(install_freerdp_man manpage section)
if(WITH_MANPAGES)
install(FILES ${manpage} DESTINATION ${CMAKE_INSTALL_MANDIR}/man${section})
endif()
endfunction()
function(generate_and_install_freerdp_man_from_template name_base section api)
if(WITH_MANPAGES)
if (WITH_BINARY_VERSIONING)
set(manpage "${CMAKE_CURRENT_BINARY_DIR}/${name_base}${api}.${section}")
else()
set(manpage "${CMAKE_CURRENT_BINARY_DIR}/${name_base}.${section}")
endif()
configure_file(${name_base}.${section}.in ${manpage})
install_freerdp_man(${manpage} ${section})
endif()
endfunction()
function(generate_and_install_freerdp_man_from_xml name_base section api dependencies)
if(WITH_MANPAGES)
set(template "${name_base}.${section}")
if (WITH_BINARY_VERSIONING)
set(MANPAGE_NAME "${name_base}${api}")
set(manpage "${name_base}${api}.${section}")
else()
set(MANPAGE_NAME "${name_base}")
set(manpage "${name_base}.${section}")
endif()
# We need the variable ${MAN_TODAY} to contain the current date in ISO
# format to replace it in the configure_file step.
include(today)
TODAY(MAN_TODAY)
configure_file(${template}.xml.in ${manpage}.xml @ONLY IMMEDIATE)
foreach(DEP IN LISTS dependencies)
set(SRC ${CMAKE_CURRENT_SOURCE_DIR}/${DEP}.in)
set(DST ${CMAKE_CURRENT_BINARY_DIR}/${DEP})
if (EXISTS ${SRC})
message("generating ${DST} from ${SRC}")
configure_file(${SRC} ${DST} @ONLY IMMEDIATE)
else()
message("using ${DST} from ${SRC}")
endif()
endforeach()
find_program(XSLTPROC_EXECUTABLE NAMES xsltproc REQUIRED)
if (NOT DOCBOOKXSL_FOUND)
message(FATAL_ERROR "docbook xsl not found but required for manpage generation")
endif()
add_custom_command(
OUTPUT "${manpage}"
COMMAND ${CMAKE_BINARY_DIR}/client/common/man/generate_argument_docbook
COMMAND ${XSLTPROC_EXECUTABLE} --path "${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}" ${DOCBOOKXSL_DIR}/manpages/docbook.xsl ${manpage}.xml
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/${manpage}.xml
generate_argument_docbook
${template}.xml.in
)
add_custom_target(
${manpage}.manpage ALL
DEPENDS
${manpage}
)
install_freerdp_man(${CMAKE_CURRENT_BINARY_DIR}/${manpage} ${section})
endif()
endfunction()
|