diff options
author | Martijn van Beurden <mvanb1@gmail.com> | 2022-09-13 10:44:36 +0200 |
---|---|---|
committer | Martijn van Beurden <mvanb1@gmail.com> | 2022-09-15 09:49:53 +0200 |
commit | 6fcee44e02d800ec8a9c4cbdfde2fbedb8bd4f88 (patch) | |
tree | 4edc5c0d5038a21b78addf9eea1b8d31f6b423a6 /CMakeLists.txt | |
parent | e8c23bf75ec1313b63dabe8bd2e5cde5332c3bcf (diff) | |
download | flac-6fcee44e02d800ec8a9c4cbdfde2fbedb8bd4f88.tar.gz |
[CMake] Make building of man pages possible
This mirrors https://github.com/xiph/flac/pull/440
and fixes https://gitlab.xiph.org/xiph/flac/-/issues/2
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 84cdf452..6b43578f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -262,5 +262,23 @@ file(GLOB FLAC++_HEADERS "include/FLAC++/*.h") install(FILES ${FLAC_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/FLAC") install(FILES ${FLAC++_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/FLAC++") if(INSTALL_MANPAGES) - install(FILES "man/flac.1" "man/metaflac.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") + find_program (HAVE_PANDOC pandoc) + if(HAVE_PANDOC) + add_custom_command( + OUTPUT man/flac.1 + COMMAND pandoc --standalone --to man "${CMAKE_SOURCE_DIR}/man/flac.md" > man/flac.1 + ) + add_custom_command( + OUTPUT man/metaflac.1 + COMMAND pandoc --standalone --to man "${CMAKE_SOURCE_DIR}/man/metaflac.md" > man/metaflac.1 + ) + add_custom_target(man ALL DEPENDS man/flac.1 man/metaflac.1) + install(FILES "${CMAKE_BINARY_DIR}/man/flac.1" "${CMAKE_BINARY_DIR}/man/metaflac.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") + else() + if(EXISTS "${CMAKE_SOURCE_DIR}/man/flac.1" AND EXISTS "${CMAKE_SOURCE_DIR}/man/metaflac.1") + install(FILES "man/flac.1" "man/metaflac.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") + else() + message(SEND_ERROR "Pandoc nor prebuild manpages are found. Cannot install manpages. Set INSTALL_MANPAGES to OFF to build without man pages") + endif() + endif() endif() |