comparison cmake/function/IrccdDefineMan.cmake @ 845:00a4720c4874

doc: rewrite documentation in manual pages, closes #1674 Get rid of markdown documentation and the custom generator tools, instead use raw manual pages.
author David Demelier <markand@malikania.fr>
date Mon, 08 Jul 2019 16:15:57 +0200
parents 06cc2f95f479
children 6af323b76970
comparison
equal deleted inserted replaced
844:dc6b42d7b97a 845:00a4720c4874
18 18
19 # 19 #
20 # irccd_define_man 20 # irccd_define_man
21 # ---------------- 21 # ----------------
22 # 22 #
23 # irccd_define_man(file, man) 23 # irccd_define_man(
24 # 24 # INPUT file path to the input man page
25 # Parameters: 25 # SECTION section (e.g. man1 man3)
26 # file The file name to build 26 # OUTPUT (Optional) file name to rename
27 # man The man section 27 # )
28 # 28 #
29 # This function configure the manual and install it if IRCCD_WITH_MAN is set. 29 # This function configure the manual and install it if IRCCD_WITH_MAN is set.
30 # 30 #
31 31
32 function(irccd_define_man file man) 32 function(irccd_define_man)
33 set(options "")
34 set(oneValueArgs "INPUT;OUTPUT;SECTION")
35 set(multiValueArgs "")
36
37 cmake_parse_arguments(MAN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
38
39 if (NOT MAN_INPUT)
40 message(FATAL_ERROR "Argument INPUT required")
41 endif ()
42 if (NOT MAN_SECTION)
43 message(FATAL_ERROR "Argument SECTION required")
44 endif ()
45
46 if (NOT MAN_OUTPUT)
47 get_filename_component(output ${MAN_INPUT} NAME)
48 else ()
49 set(output ${MAN_OUTPUT})
50 endif ()
51
33 if (IRCCD_WITH_MAN) 52 if (IRCCD_WITH_MAN)
34 set(input ${doc_SOURCE_DIR}/man/${file}.in) 53 configure_file(
35 set(output ${CMAKE_CURRENT_BINARY_DIR}/${file}) 54 ${MAN_INPUT}
36 configure_file(${input} ${output} @ONLY) 55 ${CMAKE_BINARY_DIR}/man/${output}
37 install(FILES ${output} DESTINATION ${CMAKE_INSTALL_MANDIR}/${man}) 56 @ONLY
57 )
58 install(
59 FILES ${CMAKE_BINARY_DIR}/man/${output}
60 DESTINATION ${CMAKE_INSTALL_MANDIR}/${MAN_SECTION}
61 )
38 endif () 62 endif ()
39 endfunction() 63 endfunction()