diff options
author | Otto Kekäläinen <otto@debian.org> | 2024-01-17 21:10:48 -0800 |
---|---|---|
committer | Otto Kekäläinen <otto@debian.org> | 2024-03-03 15:37:35 -0800 |
commit | ed68589af16dde7e7c4e1e01f01b0969d2eb0565 (patch) | |
tree | c33211d1132b787aec3f38aa63a89ce34cc0998c /CMakeLists.txt | |
parent | c6fbfd1e27c27cfe89b2e272c0419e57193ea8c5 (diff) |
Create man page for btop in Markdown
Create a man page in Markdown format so that it can be read online on
GitHub etc and it can be edited much more easily than a raw troff/groff
file.
Compile it to proper man page format at build-time using 'lowdown' if
it is available on the system, otherwise just issue a warning in yellow.
Tested to work both with:
export VERBOSE=1
make
make install
make uninstall
cmake -B build
cmake --build build --verbose
While Lowdown is easy to manually install in all modern Linux distros
and also Homebrew for Mac, this commit does not add 'lowdown' in any
build dependencies or in the CI, that needs to be done separately.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 01b3708..9a4dbec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -210,9 +210,24 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") target_link_libraries(btop kvm::kvm) endif() + +# Check if lowdown is installed +find_program(LOWDOWN_EXECUTABLE lowdown) + +if(LOWDOWN_EXECUTABLE) + # Custom target to compile Markdown to man page using lowdown + add_custom_target(btop.1 ALL + COMMAND lowdown -s -Tman -o btop.1 manpage.md + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) + # Install the man page + install(FILES btop.1 DESTINATION "share/man/man1") +else() + message(WARNING "Command 'lowdown' not found: skipping generating man page btop.1") +endif() + install(TARGETS btop RUNTIME) install(FILES "btop.desktop" DESTINATION "share/applications") install(FILES "Img/icon.png" DESTINATION "share/icons/hicolor/48x48/apps" RENAME "btop.png") install(FILES "Img/icon.svg" DESTINATION "share/icons/hicolor/scalable/apps" RENAME "btop.svg") install(DIRECTORY "themes" DESTINATION "share/btop") - |