1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-05 09:05:04 -05:00
curl/docs/libcurl/CMakeLists.txt
Peter Wu ec493dbda2 cmake: fix build with cmake 2.8.12.2
For some reason, CMake 2.8.12.2 did not expand the list argument in a
single DEPENDS argument. Remove the quotes, so it gets expanded into
multiple arguments for add_custom_command and add_custom_target.

Fixes https://github.com/curl/curl/issues/1370
Closes #1372
2017-03-30 23:43:35 +02:00

56 lines
2.0 KiB
CMake

# Load man_MANS from shared file
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
function(add_manual_pages _listname)
foreach(_file IN LISTS ${_listname})
if(_file STREQUAL "libcurl-symbols.3")
# Special case, an auto-generated file.
set(_srcfile "${CMAKE_CURRENT_BINARY_DIR}/${_file}")
else()
set(_srcfile "${CMAKE_CURRENT_SOURCE_DIR}/${_file}")
endif()
string(REPLACE ".3" ".html" _htmlfile "${CMAKE_CURRENT_BINARY_DIR}/${_file}")
add_custom_command(OUTPUT "${_htmlfile}"
COMMAND roffit "--mandir=${CMAKE_CURRENT_SOURCE_DIR}" "${_srcfile}" > "${_htmlfile}"
DEPENDS "${_srcfile}"
VERBATIM
)
string(REPLACE ".3" ".pdf" _pdffile "${CMAKE_CURRENT_BINARY_DIR}/${_file}")
string(REPLACE ".3" ".ps" _psfile "${CMAKE_CURRENT_BINARY_DIR}/${_file}")
# XXX any reason why groff -Tpdf (for gropdf) is not used?
add_custom_command(OUTPUT "${_pdffile}"
COMMAND groff -Tps -man "${_srcfile}" > "${_psfile}"
COMMAND ps2pdf "${_psfile}" "${_pdffile}"
COMMAND "${CMAKE_COMMAND}" -E remove "${_psfile}"
DEPENDS "${_srcfile}"
#BYPRODUCTS "${_psfile}"
VERBATIM
)
# "BYPRODUCTS" for add_custom_command requires CMake 3.2. For now hope that
# the temporary files are removed (i.e. the command is not interrupted).
endforeach()
endfunction()
add_custom_command(OUTPUT libcurl-symbols.3
COMMAND
"${PERL_EXECUTABLE}"
"${CMAKE_CURRENT_SOURCE_DIR}/mksymbolsmanpage.pl" <
"${CMAKE_CURRENT_SOURCE_DIR}/symbols-in-versions" > libcurl-symbols.3
DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/symbols-in-versions"
"${CMAKE_CURRENT_SOURCE_DIR}/mksymbolsmanpage.pl"
VERBATIM
)
add_manual_pages(man_MANS)
string(REPLACE ".3" ".html" HTMLPAGES "${man_MANS}")
string(REPLACE ".3" ".pdf" PDFPAGES "${man_MANS}")
add_custom_target(html DEPENDS ${HTMLPAGES})
add_custom_target(pdf DEPENDS ${PDFPAGES})
add_subdirectory(opts)