Permalink
Browse files

add cmake-function to generate manpages for CLI-programs and use it f…

…or the tools and isiscalc
  • Loading branch information...
1 parent 15f3f6f commit ea2c16a0bf52d5fd6cc74e61c451be8a1e6cdff2 @DerOrfa DerOrfa committed Feb 9, 2012
Showing with 28 additions and 1 deletion.
  1. +23 −0 CMakeLists.txt
  2. +1 −0 apps/isiscalc/CMakeLists.txt
  3. +4 −1 tools/CMakeLists.txt
View
@@ -100,6 +100,29 @@ find_package(Boost REQUIRED COMPONENTS filesystem regex system date_time)
include_directories(${Boost_INCLUDE_DIR})
+############################################################
+# Macro to generate manpages for CLI programms
+############################################################
+set(MANPAGES OFF CACHE BOOL "Create manpages for the tools")
+
+if(MANPAGES)
+ find_program(HELP2MAN help2man)
+endif(MANPAGES)
+
+macro( build_manpage name)
+ if(MANPAGES)
+ add_custom_command(
+ TARGET ${name}
+ POST_BUILD
+ COMMAND ${HELP2MAN} ./${name} --version-string=${ISIS_CORE_REV_STRING} --no-discard-stderr --no-info -o ${name}.1 -s 1
+ COMMENT "Generating manpage ${name}.1"
+ VERBATIM
+ )
+ endif(MANPAGES)
+endmacro( build_manpage )
+
+
+
############################################################
# RCS revision number
############################################################
@@ -17,6 +17,7 @@ include_directories(${INCPATH_MUPARSER})
add_executable(isiscalc isiscalc.cpp)
target_link_libraries(isiscalc ${LIB_MUPARSER} isis_core ${ISIS_LIB_DEPENDS})
set_target_properties(isiscalc PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
+build_manpage(isiscalc)
############################################################
# the install targets.
View
@@ -21,25 +21,28 @@
###########################################################
include_directories(${CMAKE_SOURCE_DIR}/lib/Core)
-
############################################################
# configure the targets
############################################################
add_executable(isisdump isisdump.cpp)
target_link_libraries(isisdump isis_core ${ISIS_LIB_DEPENDS})
set_target_properties(isisdump PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
+build_manpage(isisdump)
add_executable(isisdiff isisdiff.cpp)
target_link_libraries(isisdiff isis_core ${ISIS_LIB_DEPENDS})
set_target_properties(isisdiff PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
+build_manpage(isisdiff)
add_executable(isisconv isisconv.cpp)
target_link_libraries(isisconv isis_core ${ISIS_LIB_DEPENDS})
set_target_properties(isisconv PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
+build_manpage(isisconv)
add_executable(isisflip isisflip.cpp)
target_link_libraries(isisflip isis_core ${ISIS_LIB_DEPENDS})
set_target_properties(isisflip PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
+build_manpage(isisflip)
# the install targets.
install(TARGETS

0 comments on commit ea2c16a

Please sign in to comment.