File tree Expand file tree Collapse file tree 2 files changed +21
-9
lines changed Expand file tree Collapse file tree 2 files changed +21
-9
lines changed Original file line number Diff line number Diff line change 8
8
# =============== Project initialization ===============
9
9
# ======================================================
10
10
11
- cmake_minimum_required (VERSION 3.14 )
11
+ cmake_minimum_required (VERSION 3.20 )
12
12
13
13
project (zswap-cli
14
14
VERSION 0.9.1
@@ -235,9 +235,8 @@ if (BUILD_DOC)
235
235
endif ()
236
236
237
237
if (BUILD_MANPAGE )
238
- configure_file ("assets/manpage/${APP_NAME} .md.in" "${CMAKE_CURRENT_BINARY_DIR} /${APP_NAME} .md" @ONLY )
239
- build_manpage ("${CMAKE_CURRENT_BINARY_DIR} /${APP_NAME} .md" "${CMAKE_CURRENT_BINARY_DIR} /${APP_NAME} .1" )
240
- add_custom_target (${MAN_NAME} ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR} /${APP_NAME} .1" )
238
+ configure_file ("assets/manpage/${APP_NAME} .md.in" "${CMAKE_CURRENT_BINARY_DIR} /${APP_NAME} .1.md" @ONLY )
239
+ pandoc_add_manpages (${MAN_NAME} FILES "${CMAKE_CURRENT_BINARY_DIR} /${APP_NAME} .1.md" )
241
240
install (FILES "${CMAKE_CURRENT_BINARY_DIR} /${APP_NAME} .1" DESTINATION "${CMAKE_INSTALL_MANDIR} /man1" )
242
241
endif ()
243
242
Original file line number Diff line number Diff line change @@ -13,14 +13,27 @@ if (BUILD_MANPAGE)
13
13
)
14
14
mark_as_advanced (Pandoc_EXECUTABLE )
15
15
16
- function (build_manpage SrcName DestName )
16
+ function (_build_manpage _srcname _destname )
17
17
add_custom_command (
18
- OUTPUT "${DestName } "
18
+ OUTPUT "${_destname } "
19
19
COMMAND "${Pandoc_EXECUTABLE} "
20
- ARGS "${SrcName } " -s -t man -o "${DestName } "
21
- DEPENDS "${SrcName } "
22
- COMMENT "Building the ${DestName} manpage using Pandoc."
20
+ ARGS "${_srcname } " -s -t man -o "${_destname } "
21
+ DEPENDS "${_srcname } "
22
+ COMMENT "Building the manpage using Pandoc."
23
23
VERBATIM
24
24
)
25
25
endfunction ()
26
+
27
+ function (pandoc_add_manpages TargetName )
28
+ set (_arguments_options )
29
+ set (_arguments_one )
30
+ set (_arguments_multi FILES )
31
+ cmake_parse_arguments (_arguments "${_arguments_options} " "${_arguments_one} " "${_arguments_multi} " ${ARGN} )
32
+ foreach (_srcfile IN LISTS _arguments_FILES )
33
+ cmake_path (REMOVE_EXTENSION _srcfile LAST_ONLY OUTPUT_VARIABLE _manfile )
34
+ list (APPEND _manfiles "${_manfile} " )
35
+ _build_manpage ("${_srcfile} " "${_manfile} " )
36
+ endforeach ()
37
+ add_custom_target (${TargetName} ALL DEPENDS ${_manfiles} )
38
+ endfunction ()
26
39
endif ()
You can’t perform that action at this time.
0 commit comments