1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 09:27:59 +00:00

Add the man pages to the 'make install' target.

doc/CMakeLists.txt now sets a variable indicating that we either have,
or can build, each individual man page. And when we call our
installed_program() function to mark a program as official enough to
put in 'make install', that function also installs the man page
similarly if it exists, and warns if not.

For the convenience of people building-and-installing from the .tar.gz
we ship, I've arranged that they can still get the man pages installed
without needing Halibut: the previous commit ensured that the prebuilt
man pages are still in the tarball, and this one arranges that if we
don't have Halibut but we do have prebuilt man pages, then we can
'build' them by copying from the prebuilt versions.
This commit is contained in:
Simon Tatham 2021-05-03 16:25:21 +01:00
parent 31f496b59c
commit e706c04451
3 changed files with 18 additions and 0 deletions

View File

@ -3,6 +3,8 @@ project(putty LANGUAGES C)
include(cmake/setup.cmake)
# Scan the docs directory first, so that when we start calling
# installed_program(), we'll know if we have man pages available
add_subdirectory(doc)
add_compile_definitions(HAVE_CMAKE_H)

View File

@ -8,6 +8,7 @@ include(CheckIncludeFile)
include(CheckLibraryExists)
include(CheckSymbolExists)
include(CheckCSourceCompiles)
include(GNUInstallDirs)
set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
-D_DEFAULT_SOURCE -D_GNU_SOURCE)
@ -120,4 +121,11 @@ function(installed_program target)
# CMAKE_INSTALL_BINDIR.
install(TARGETS ${target})
endif()
if(HAVE_MANPAGE_${target}_1)
install(FILES ${CMAKE_BINARY_DIR}/doc/${target}.1
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
else()
message(WARNING "Could not build man page ${target}.1")
endif()
endfunction()

View File

@ -103,6 +103,14 @@ macro(manpage title section)
DEPENDS
mancfg.but man-${title}.but)
list(APPEND manpage_outputs ${title}.${section})
set(HAVE_MANPAGE_${title}_${section} ON PARENT_SCOPE)
elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${title}.${section})
add_custom_command(OUTPUT ${title}.${section}
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/${title}.${section} ${title}.${section}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${title}.${section})
list(APPEND manpage_outputs ${title}.${section})
set(HAVE_MANPAGE_${title}_${section} ON PARENT_SCOPE)
endif()
endmacro()