Allow to build man pages on Windows

Why not if xsltproc available?
Moreover why try to install not existent files?

Signed-off-by: Konstantin Podsvirov <konstantin@podsvirov.pro>
This commit is contained in:
Konstantin Podsvirov 2021-11-06 16:31:20 +03:00
parent 46a6c5d17b
commit 0de3f3a3f7

View File

@ -4,44 +4,45 @@
# could not be found, then the man pages will not be built or installed - # could not be found, then the man pages will not be built or installed -
# because the install is optional. # because the install is optional.
if(NOT WIN32) find_program(XSLTPROC xsltproc OPTIONAL)
find_program(XSLTPROC xsltproc OPTIONAL) if(XSLTPROC)
if(XSLTPROC) function(compile_manpage page)
function(compile_manpage page) add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/man/${page}
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/man/${page} COMMAND xsltproc ${CMAKE_SOURCE_DIR}/man/${page}.xml -o ${CMAKE_SOURCE_DIR}/man/
COMMAND xsltproc ${CMAKE_SOURCE_DIR}/man/${page}.xml -o ${CMAKE_SOURCE_DIR}/man/ MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/man/${page}.xml)
MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/man/${page}.xml) add_custom_target(${page} ALL DEPENDS ${CMAKE_SOURCE_DIR}/man/${page})
add_custom_target(${page} ALL DEPENDS ${CMAKE_SOURCE_DIR}/man/${page}) endfunction()
endfunction()
compile_manpage("mosquitto_ctrl.1") compile_manpage("mosquitto_ctrl.1")
compile_manpage("mosquitto_ctrl_dynsec.1") compile_manpage("mosquitto_ctrl_dynsec.1")
compile_manpage("mosquitto_passwd.1") compile_manpage("mosquitto_passwd.1")
compile_manpage("mosquitto_pub.1") compile_manpage("mosquitto_pub.1")
compile_manpage("mosquitto_sub.1") compile_manpage("mosquitto_sub.1")
compile_manpage("mosquitto_rr.1") compile_manpage("mosquitto_rr.1")
compile_manpage("libmosquitto.3") compile_manpage("libmosquitto.3")
compile_manpage("mosquitto.conf.5") compile_manpage("mosquitto.conf.5")
compile_manpage("mosquitto-tls.7") compile_manpage("mosquitto-tls.7")
compile_manpage("mqtt.7") compile_manpage("mqtt.7")
compile_manpage("mosquitto.8") compile_manpage("mosquitto.8")
else()
message(FATAL_ERROR "xsltproc not found: manpages cannot be built")
endif()
install(FILES
mosquitto_ctrl.1
mosquitto_ctrl_dynsec.1
mosquitto_passwd.1
mosquitto_pub.1
mosquitto_sub.1
mosquitto_rr.1
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
OPTIONAL)
install(FILES libmosquitto.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3 OPTIONAL)
install(FILES mosquitto.conf.5 DESTINATION ${CMAKE_INSTALL_MANDIR}/man5 OPTIONAL)
install(FILES mosquitto-tls.7 mqtt.7 DESTINATION ${CMAKE_INSTALL_MANDIR}/man7 OPTIONAL)
install(FILES mosquitto.8 DESTINATION ${CMAKE_INSTALL_MANDIR}/man8 OPTIONAL)
elseif(WIN32)
message(WARNING "xsltproc not found: manpages cannot be built")
else()
message(FATAL_ERROR "xsltproc not found: manpages cannot be built")
endif() endif()
install(FILES
mosquitto_ctrl.1
mosquitto_ctrl_dynsec.1
mosquitto_passwd.1
mosquitto_pub.1
mosquitto_sub.1
mosquitto_rr.1
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
OPTIONAL)
install(FILES libmosquitto.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3 OPTIONAL)
install(FILES mosquitto.conf.5 DESTINATION ${CMAKE_INSTALL_MANDIR}/man5 OPTIONAL)
install(FILES mosquitto-tls.7 mqtt.7 DESTINATION ${CMAKE_INSTALL_MANDIR}/man7 OPTIONAL)
install(FILES mosquitto.8 DESTINATION ${CMAKE_INSTALL_MANDIR}/man8 OPTIONAL)