[cmake] unify windows resource file generation

* use a macro to add resource files for executables and shared libraries
* use that macro to declare targets
* use that macro to set library/binary versioning
* use that macro to set target output name
* use a macro to create manpages and names
This commit is contained in:
akallabeth
2024-03-19 12:19:07 +01:00
committed by akallabeth
parent ea9e219867
commit 678ff144ab
38 changed files with 215 additions and 670 deletions

View File

@@ -7,11 +7,27 @@ function(install_freerdp_man manpage section)
endif()
endfunction()
function(generate_and_install_freerdp_man_from_xml template manpage dependencies)
function(generate_and_install_freerdp_man_from_template name_base section api)
if(WITH_MANPAGES)
find_program(XSLTPROC_EXECUTABLE NAMES xsltproc REQUIRED)
if (NOT DOCBOOKXSL_FOUND)
message(FATAL_ERROR "docbook xsl not found but required for manpage generation")
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
@@ -34,8 +50,13 @@ function(generate_and_install_freerdp_man_from_xml template manpage dependencies
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}
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}
@@ -50,6 +71,6 @@ function(generate_and_install_freerdp_man_from_xml template manpage dependencies
DEPENDS
${manpage}
)
install_freerdp_man(${CMAKE_CURRENT_BINARY_DIR}/${manpage} 1)
install_freerdp_man(${CMAKE_CURRENT_BINARY_DIR}/${manpage} ${section})
endif()
endfunction()