From: <hug...@li...> - 2011-01-01 15:08:56
|
branch: details: http://hugin.hg.sourceforge.net/hgweb/hugin/hugin/hgrepo/h/hu/hugin/hugin/rev/cf62dd625f73 changeset: 4786:cf62dd625f73 user: Yuval Levy <yu...@us...> date: Sat Jan 01 09:58:29 2011 -0500 description: improved CMake driven generation of man pages diffstat: doc/CMakeLists.txt | 25 ++++++++++++++++++++----- 1 files changed, 20 insertions(+), 5 deletions(-) diffs (62 lines): diff -r 10a4e06dcf41 -r cf62dd625f73 doc/CMakeLists.txt --- a/doc/CMakeLists.txt Thu Dec 30 09:07:17 2010 +0100 +++ b/doc/CMakeLists.txt Sat Jan 01 09:58:29 2011 -0500 @@ -8,7 +8,6 @@ ELSE (WIN32) # For all other systems, generate and install the man pages -ADD_CUSTOM_TARGET(ManPages ALL) FIND_PROGRAM(POD2MAN pod2man) @@ -17,23 +16,37 @@ ENDMACRO(install_man) MACRO(do_pod podfile manfile section) - IF(EXISTS ${podfile}) + IF(EXISTS "${CMAKE_SOURCE_DIR}/doc/${podfile}") IF(POD2MAN) SET(outfile "${manfile}.${section}") # TODO: fix the unaesthetic double quotes in which the HUGIN_PACKAGE_VERSION # is displayed on the resulting man page - EXECUTE_PROCESS(COMMAND ${POD2MAN} --section="${section}" --release="Version: ${HUGIN_PACKAGE_VERSION}" --center=HUGIN ${podfile} ${outfile}) + ADD_CUSTOM_COMMAND( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${outfile}" + COMMAND ${POD2MAN} --section="${section}" --release="Version: ${HUGIN_PACKAGE_VERSION}" --center=HUGIN "${CMAKE_CURRENT_BINARY_DIR}/${podfile}" "${CMAKE_CURRENT_BINARY_DIR}/${outfile}" + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${podfile}" + VERBATIM + ) install_man(${outfile} ${section}) + LIST(APPEND ManDeps "${CMAKE_CURRENT_BINARY_DIR}/${outfile}") ENDIF(POD2MAN) - ENDIF(EXISTS ${podfile}) + ENDIF() ENDMACRO(do_pod) MACRO(do_doc) # automatically include all pod files in the directory - FILE(GLOB POD_FILES *.pod) + FILE(GLOB POD_FILES RELATIVE "${CMAKE_SOURCE_DIR}/doc" *.pod) # all our man pages go into section 1 SET(MANSECTION 1) FOREACH(PODFILE ${POD_FILES}) + ADD_CUSTOM_COMMAND( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${PODFILE}" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/doc/${PODFILE}" "${CMAKE_CURRENT_BINARY_DIR}/${PODFILE}" + DEPENDS "${CMAKE_SOURCE_DIR}/doc/${PODFILE}" + COMMENT "copying ${CMAKE_SOURCE_DIR}/doc/${PODFILE} to ${CMAKE_CURRENT_BINARY_DIR}/${PODFILE}" + VERBATIM + ) + SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/${PODFILE}" GENERATED) STRING(REGEX REPLACE "\\.pod$" "" MANFILE "${PODFILE}") # TODO: this currently messes up source tree as MANFILE is implicitly # inside the same folder as PODFILE. change that do to the @@ -43,6 +56,8 @@ ENDFOREACH(PODFILE ${POD_FILES}) ENDMACRO(do_doc) +set(ManDeps) do_doc() +ADD_CUSTOM_TARGET(ManPages ALL DEPENDS ${ManDeps}) ENDIF(WIN32) |