@@ -38,4 +38,33 @@ if(BUILD_DOC)
else (DOXYGEN_FOUND)
message("Doxygen need to be installed to generate the doxygen documentation")
endif (DOXYGEN_FOUND)
+
+ find_program(SCDOC scdoc)
+ if (SCDOC)
+ include(GNUInstallDirs)
+ set(MAN_NAMES fw_printenv.1 fw_setenv.1 fw_env.config.5)
+ set(MAN_FILES)
+ foreach(m IN LISTS MAN_NAMES)
+ set(ms ${CMAKE_SOURCE_DIR}/docs/${m}.scd)
+ set(mf ${CMAKE_BINARY_DIR}/${m}.gz)
+ add_custom_command(OUTPUT ${mf}
+ COMMAND ${SCDOC} < ${ms} | gzip > ${mf}
+ DEPENDS ${ms}
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ COMMENT "Building manpage ${mf}"
+ VERBATIM)
+ list(APPEND MAN_FILES ${mf})
+
+ string(REGEX REPLACE ".*\\.([^\\.+])(\\.gz)?\$"
+ "\\1" MAN_SECTION
+ ${mf})
+ install(FILES ${mf}
+ DESTINATION ${CMAKE_INSTALL_MANDIR}/man${MAN_SECTION})
+ endforeach()
+
+ add_custom_target(man ALL DEPENDS ${MAN_FILES})
+
+ else (SCDOC)
+ message("The scdoc command need to be installed to generate the manpages")
+ endif (SCDOC)
endif()
If more manpages are added in the future, they should be added in the MAN_NAMES variable and that should be it. Unfortunately the cmake "install(FILES ${MAN_FILES} TYPE MAN)" doesn't seem to work right and just drops the manpage straight into .../share/man/ rather than in a sectioned subdir, thus the ugly string regexp mangling. Signed-off-by: Andreas Henriksson <andreas@fatal.se> --- CMakeLists.txt | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)