stlink/doc/man/CMakeLists.txt

37 wiersze
1.0 KiB
CMake
Czysty Zwykły widok Historia

###
# Generate manpages
###
2020-04-05 12:57:59 +00:00
set(MANPAGES st-util st-flash st-info)
# 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()
# 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()
2020-04-05 12:57:59 +00:00
if (f AND NOT WIN32)
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 ()