[doc] CMake: rename Perl modules' man pages (::)

Perl modules' man pages should be named Foo::Bar.3perl instead of
Foo--Bar.3perl. This is fixed but the solution is incomplete and hacky,
due to a limitation of make: Foo--Bar.3perl is first generated, then
renamed to Foo::Bar.3perl. This breaks the dependencies and
Foo--Bar.3perl will be re-generated at each run of make.
This commit is contained in:
Matteo Cypriani 2013-09-11 16:04:19 -04:00
parent 810d02d5b8
commit 3edf06337c
1 changed files with 9 additions and 4 deletions

View File

@ -73,9 +73,10 @@ else()
function(add_pod_manpage SOURCE PAGENAME SECTION)
set(OUTPUT_DIRECTORY "${MAN_OUTPUT_DIRECTORY}/man${SECTION}")
set(TARGETNAME "${PAGENAME}.${SECTION}")
set(FINALTARGETFILE "${OUTPUT_DIRECTORY}/${TARGETNAME}")
# Change TARGETNAME so that the CMake target don't contain any ':'
string(REGEX REPLACE ":" "-" TARGETNAME ${TARGETNAME})
set(TARGET "${OUTPUT_DIRECTORY}/${TARGETNAME}")
set(TARGETFILE "${OUTPUT_DIRECTORY}/${TARGETNAME}")
# Create the output directory
# Note: this is done only when first calling cmake and when rebuilding
@ -96,16 +97,20 @@ else()
# Command to generate the man page
add_custom_command(
OUTPUT "${TARGET}"
COMMAND "${POD2MAN_EXECUTABLE}" --center "OwlPS User Manual" --release "OwlPS ${OWLPS_VERSION}" --date "${DATE}" "${SOURCE}" "${TARGET}"
OUTPUT "${TARGETFILE}"
COMMAND "${POD2MAN_EXECUTABLE}" --center "OwlPS User Manual" --release "OwlPS ${OWLPS_VERSION}" --date "${DATE}" "${SOURCE}" "${TARGETFILE}"
COMMAND ${CMAKE_COMMAND} -E rename "${TARGETFILE}" "${FINALTARGETFILE}"
DEPENDS "${SOURCE}"
COMMENT "Generating ${TARGETNAME}")
# Set up the target
add_custom_target("${TARGETNAME}" true DEPENDS "${TARGET}")
add_custom_target("${TARGETNAME}" true DEPENDS "${TARGETFILE}")
# Add the target to the "doc" meta-target
add_dependencies(doc "${TARGETNAME}")
# Add a special cleaning rule (in case the file was renamed)
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${FINALTARGETFILE}")
endfunction()
add_pod_manpage(${CMAKE_SOURCE_DIR}/scripts/owlps-aggcheck.pl owlps-aggcheck 1)