include(GNUInstallDirs) add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.1" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" DEPENDS "${PROJECT_NAME}.1.adoc" COMMAND "${PROJECT_SOURCE_DIR}/man/build_manpage.sh" ARGS "${PROJECT_VERSION}") add_custom_target(man ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.1") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)