2020-04-25 20:34:18 +00:00
|
|
|
###
|
|
|
|
# Generate manpages
|
|
|
|
###
|
|
|
|
|
2020-04-05 12:57:59 +00:00
|
|
|
set(MANPAGES st-util st-flash st-info)
|
2016-09-15 08:44:01 +00:00
|
|
|
|
|
|
|
# Only generate manpages with pandoc in Debug builds
|
2020-04-05 12:57:59 +00:00
|
|
|
if (${STLINK_GENERATE_MANPAGES})
|
|
|
|
include(pandocology)
|
|
|
|
foreach (manpage ${MANPAGES})
|
|
|
|
add_document(
|
|
|
|
${manpage}.1
|
|
|
|
SOURCES ${manpage}.md
|
|
|
|
PANDOC_DIRECTIVES -s -t man
|
|
|
|
PRODUCT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
)
|
|
|
|
endforeach ()
|
|
|
|
else ()
|
|
|
|
message(STATUS "Manpage generation disabled")
|
2023-06-24 21:55:12 +00:00
|
|
|
endif()
|
2016-09-15 20:29:59 +00:00
|
|
|
|
|
|
|
# Install from output folder or this folder
|
2020-04-05 12:57:59 +00:00
|
|
|
foreach (manpage ${MANPAGES})
|
|
|
|
if (EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${manpage}.1)
|
|
|
|
set(f "${CMAKE_CURRENT_BINARY_DIR}/${manpage}.1")
|
|
|
|
elseif (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${manpage}.1")
|
|
|
|
set(f "${CMAKE_CURRENT_SOURCE_DIR}/${manpage}.1")
|
|
|
|
else()
|
|
|
|
message(AUTHOR_WARNING "Manpage ${manpage} not generated")
|
2023-06-24 21:55:12 +00:00
|
|
|
endif()
|
2016-09-15 20:29:59 +00:00
|
|
|
|
2020-04-05 12:57:59 +00:00
|
|
|
if (f AND NOT WIN32)
|
2022-10-23 23:49:03 +00:00
|
|
|
install(FILES ${f} DESTINATION ${CMAKE_INSTALL_DATADIR}/man/man1)
|
2020-04-05 12:57:59 +00:00
|
|
|
unset(f)
|
2023-06-24 21:55:12 +00:00
|
|
|
endif()
|
2020-04-05 12:57:59 +00:00
|
|
|
endforeach ()
|