2022-08-16 11:01:50 +03:00
|
|
|
include(GNUInstallDirs)
|
2023-12-14 16:13:53 +03:00
|
|
|
include(FindDocBookXSL)
|
2022-08-16 11:01:50 +03:00
|
|
|
|
2017-01-16 13:34:32 +03:00
|
|
|
function(install_freerdp_man manpage section)
|
2024-02-21 13:37:28 +03:00
|
|
|
if(WITH_MANPAGES)
|
|
|
|
install(FILES ${manpage} DESTINATION ${CMAKE_INSTALL_MANDIR}/man${section})
|
|
|
|
endif()
|
2017-01-16 13:34:32 +03:00
|
|
|
endfunction()
|
2023-12-14 16:13:53 +03:00
|
|
|
|
2024-03-19 14:19:07 +03:00
|
|
|
function(generate_and_install_freerdp_man_from_template name_base section api)
|
2024-02-21 13:37:28 +03:00
|
|
|
if(WITH_MANPAGES)
|
2024-03-19 14:19:07 +03:00
|
|
|
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()
|
|
|
|
|
2024-05-16 10:36:27 +03:00
|
|
|
function(generate_and_install_freerdp_man_from_xml target section dependencies)
|
2024-03-19 14:19:07 +03:00
|
|
|
if(WITH_MANPAGES)
|
2024-05-16 10:36:27 +03:00
|
|
|
get_target_property(name_base ${target} OUTPUT_NAME)
|
|
|
|
set(template "${target}.${section}")
|
|
|
|
set(MANPAGE_NAME "${name_base}")
|
|
|
|
set(manpage "${name_base}.${section}")
|
2024-02-21 13:37:28 +03:00
|
|
|
|
|
|
|
# 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()
|
|
|
|
|
2024-03-19 14:19:07 +03:00
|
|
|
find_program(XSLTPROC_EXECUTABLE NAMES xsltproc REQUIRED)
|
|
|
|
if (NOT DOCBOOKXSL_FOUND)
|
|
|
|
message(FATAL_ERROR "docbook xsl not found but required for manpage generation")
|
|
|
|
endif()
|
|
|
|
|
2024-02-21 13:37:28 +03:00
|
|
|
add_custom_command(
|
2024-03-19 14:19:07 +03:00
|
|
|
OUTPUT "${manpage}"
|
2024-02-21 13:37:28 +03:00
|
|
|
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}
|
|
|
|
)
|
2024-03-19 14:19:07 +03:00
|
|
|
install_freerdp_man(${CMAKE_CURRENT_BINARY_DIR}/${manpage} ${section})
|
2023-12-14 16:13:53 +03:00
|
|
|
endif()
|
|
|
|
endfunction()
|