Fixed generation of configure header, now replacing date fields
with current date. Added CMake script to generate a variable containing the current date. Removed last argument (the terminating NULL element) from output.
This commit is contained in:
parent
75e2b2a5ef
commit
e92eef9579
@ -65,17 +65,26 @@ set(${MODULE_PREFIX}_LIBS
|
||||
${CMAKE_DL_LIBS})
|
||||
|
||||
if(WITH_MANPAGES)
|
||||
if(XMLTO_FOUND)
|
||||
# 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(xfreerdp.1.xml.in xfreerdp.1.xml @ONLY)
|
||||
|
||||
add_executable(generate_argument_docbook
|
||||
generate_argument_docbook.c)
|
||||
target_link_libraries(generate_argument_docbook winpr-utils freerdp-core freerdp-utils freerdp-client)
|
||||
|
||||
if(XMLTO_FOUND)
|
||||
add_custom_command(OUTPUT xfreerdp.1
|
||||
COMMAND generate_argument_docbook
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp.1.xml ${CMAKE_CURRENT_BINARY_DIR}/
|
||||
COMMAND ${XMLTO_EXECUTABLE} man xfreerdp.1.xml
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
DEPENDS xfreerdp.1.xml generate_argument_docbook)
|
||||
DEPENDS
|
||||
${CMAKE_CURRENT_BINARY_DIR}/xfreerdp.1.xml
|
||||
generate_argument_docbook)
|
||||
|
||||
add_custom_target(xfreerdp.manpage ALL
|
||||
DEPENDS xfreerdp.1)
|
||||
|
@ -123,6 +123,7 @@ LPCSTR tr_esc_str(LPCSTR arg)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
size_t elements = sizeof(args)/sizeof(args[0]);
|
||||
size_t x;
|
||||
const char *fname = "xfreerdp-argument.1.xml";
|
||||
FILE *fp = NULL;
|
||||
@ -142,7 +143,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Iterate over argument struct and write data to docbook 4.5
|
||||
* compatible XML */
|
||||
for(x=0; x<sizeof(args)/sizeof(args[0]); x++)
|
||||
if( elements < 2 )
|
||||
{
|
||||
fprintf(stderr, "The argument array 'args' is empty, writing an empty file.");
|
||||
elements = 1;
|
||||
}
|
||||
|
||||
for(x=0; x<elements - 1; x++)
|
||||
{
|
||||
const COMMAND_LINE_ARGUMENT_A *arg = &args[x];
|
||||
|
||||
|
@ -8,7 +8,7 @@ PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
|
||||
<refentry>
|
||||
<refentryinfo>
|
||||
<date>2013-08-05</date>
|
||||
<date>@MAN_TODAY@</date>
|
||||
<author>
|
||||
<authorblurb><para>The FreeRDP Team</para></authorblurb>
|
||||
</author>
|
||||
@ -25,7 +25,7 @@ PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
</refnamediv>
|
||||
<refsynopsisdiv>
|
||||
<refsynopsisdivinfo>
|
||||
<date>2013-08-05</date>
|
||||
<date>@MAN_TODAY@</date>
|
||||
</refsynopsisdivinfo>
|
||||
<para>
|
||||
<command>xfreerdp</command> [file] [options] [/v:server[:port]]
|
||||
@ -33,7 +33,7 @@ PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
</refsynopsisdiv>
|
||||
<refsect1>
|
||||
<refsect1info>
|
||||
<date>2011-08-27</date>
|
||||
<date>@MAN_TODAY@</date>
|
||||
</refsect1info>
|
||||
<title>DESCRIPTION</title>
|
||||
<para>
|
16
cmake/today.cmake
Normal file
16
cmake/today.cmake
Normal file
@ -0,0 +1,16 @@
|
||||
# This script returns the current date in ISO format
|
||||
#
|
||||
# YYYY-MM-DD
|
||||
#
|
||||
MACRO (TODAY RESULT)
|
||||
IF (WIN32)
|
||||
EXECUTE_PROCESS(COMMAND "cmd" " /C date +%Y-%m-%d" OUTPUT_VARIABLE ${RESULT})
|
||||
string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" ${RESULT} ${${RESULT}})
|
||||
ELSEIF(UNIX)
|
||||
EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d" OUTPUT_VARIABLE ${RESULT})
|
||||
string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" ${RESULT} ${${RESULT}})
|
||||
ELSE (WIN32)
|
||||
MESSAGE(SEND_ERROR "date not implemented")
|
||||
SET(${RESULT} 000000)
|
||||
ENDIF (WIN32)
|
||||
ENDMACRO (TODAY)
|
Loading…
Reference in New Issue
Block a user