cmake: build manual pages (including curl.1)

Also make Perl mandatory to allow building the docs.

While CMakeLists.txt could probably read the list of manual pages from
Makefile.am, actually putting those in CMakeLists.txt is cleaner so that
is what is done here.

Fixes #1230
Ref: https://github.com/curl/curl/pull/1288
This commit is contained in:
Peter Wu 2017-02-25 14:40:24 +01:00
parent 6f6e9193df
commit 84a226a30b
4 changed files with 24 additions and 6 deletions

3
docs/CMakeLists.txt Normal file
View file

@ -0,0 +1,3 @@
#add_subdirectory(examples)
#add_subdirectory(libcurl)
add_subdirectory(cmdline-opts)

View file

@ -0,0 +1,12 @@
set(MANPAGE "${CMAKE_BINARY_DIR}/docs/curl.1")
# Load DPAGES and OTHERPAGES from shared file
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
add_custom_command(OUTPUT "${MANPAGE}"
COMMAND "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/gen.pl" mainpage "${CMAKE_CURRENT_SOURCE_DIR}" > "${MANPAGE}"
DEPENDS "${DPAGES}" "${OTHERPAGES}"
VERBATIM
)
add_custom_target(generate-curl.1 DEPENDS "${MANPAGE}")