build: get the man cmake target to work in VS

This commit is contained in:
Eric Wasylishen 2016-04-09 16:29:59 -07:00
parent b6da18fca8
commit c1865363de
1 changed files with 11 additions and 9 deletions

View File

@ -1,20 +1,22 @@
cmake_minimum_required (VERSION 2.6) cmake_minimum_required (VERSION 2.6)
project (man) project (man)
find_program (GROFF NAMES groff) find_program (GROFF groff)
if (GROFF-NOTFOUND)
message(FATAL_ERROR "Could not find groff")
endif(GROFF-NOTFOUND)
if(GROFF) if(GROFF)
set(MANPAGES qbsp vis light bsputil bspinfo) set(MANPAGES qbsp vis light bsputil bspinfo)
foreach(MANPAGE ${MANPAGES}) foreach(MANPAGE ${MANPAGES})
add_custom_command( add_custom_command(
OUTPUT ${MANPAGE}.txt OUTPUT ${MANPAGE}.html
COMMAND ${GROFF} -Tascii -man ${CMAKE_SOURCE_DIR}/man/${MANPAGE}.1 | col -bx > ${MANPAGE}.txt COMMAND ${GROFF} -Thtml -man ${CMAKE_SOURCE_DIR}/man/${MANPAGE}.1 > ${MANPAGE}.html
) )
add_custom_target(man_${MANPAGE} ALL DEPENDS ${MANPAGE}.txt) add_custom_target(man_${MANPAGE} DEPENDS ${MANPAGE}.html)
install(FILES ${MANPAGE}.txt DESTINATION doc) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${MANPAGE}.html DESTINATION doc)
endforeach() endforeach()
#make each of the main targets depend on the manuals
add_dependencies(qbsp man_qbsp)
add_dependencies(vis man_vis)
add_dependencies(light man_light)
add_dependencies(bsputil man_bsputil)
add_dependencies(bspinfo man_bspinfo)
endif(GROFF) endif(GROFF)