[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:
parent
810d02d5b8
commit
3edf06337c
|
@ -73,9 +73,10 @@ else()
|
||||||
function(add_pod_manpage SOURCE PAGENAME SECTION)
|
function(add_pod_manpage SOURCE PAGENAME SECTION)
|
||||||
set(OUTPUT_DIRECTORY "${MAN_OUTPUT_DIRECTORY}/man${SECTION}")
|
set(OUTPUT_DIRECTORY "${MAN_OUTPUT_DIRECTORY}/man${SECTION}")
|
||||||
set(TARGETNAME "${PAGENAME}.${SECTION}")
|
set(TARGETNAME "${PAGENAME}.${SECTION}")
|
||||||
|
set(FINALTARGETFILE "${OUTPUT_DIRECTORY}/${TARGETNAME}")
|
||||||
# Change TARGETNAME so that the CMake target don't contain any ':'
|
# Change TARGETNAME so that the CMake target don't contain any ':'
|
||||||
string(REGEX REPLACE ":" "-" TARGETNAME ${TARGETNAME})
|
string(REGEX REPLACE ":" "-" TARGETNAME ${TARGETNAME})
|
||||||
set(TARGET "${OUTPUT_DIRECTORY}/${TARGETNAME}")
|
set(TARGETFILE "${OUTPUT_DIRECTORY}/${TARGETNAME}")
|
||||||
|
|
||||||
# Create the output directory
|
# Create the output directory
|
||||||
# Note: this is done only when first calling cmake and when rebuilding
|
# Note: this is done only when first calling cmake and when rebuilding
|
||||||
|
@ -96,16 +97,20 @@ else()
|
||||||
|
|
||||||
# Command to generate the man page
|
# Command to generate the man page
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT "${TARGET}"
|
OUTPUT "${TARGETFILE}"
|
||||||
COMMAND "${POD2MAN_EXECUTABLE}" --center "OwlPS User Manual" --release "OwlPS ${OWLPS_VERSION}" --date "${DATE}" "${SOURCE}" "${TARGET}"
|
COMMAND "${POD2MAN_EXECUTABLE}" --center "OwlPS User Manual" --release "OwlPS ${OWLPS_VERSION}" --date "${DATE}" "${SOURCE}" "${TARGETFILE}"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E rename "${TARGETFILE}" "${FINALTARGETFILE}"
|
||||||
DEPENDS "${SOURCE}"
|
DEPENDS "${SOURCE}"
|
||||||
COMMENT "Generating ${TARGETNAME}")
|
COMMENT "Generating ${TARGETNAME}")
|
||||||
|
|
||||||
# Set up the target
|
# 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 the target to the "doc" meta-target
|
||||||
add_dependencies(doc "${TARGETNAME}")
|
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()
|
endfunction()
|
||||||
|
|
||||||
add_pod_manpage(${CMAKE_SOURCE_DIR}/scripts/owlps-aggcheck.pl owlps-aggcheck 1)
|
add_pod_manpage(${CMAKE_SOURCE_DIR}/scripts/owlps-aggcheck.pl owlps-aggcheck 1)
|
||||||
|
|
Loading…
Reference in New Issue