[PATCH] CMake targets for building man pages

Andrew Wilkins axwalk at gmail.com
Mon Jun 8 00:51:22 PDT 2015


Hi chandlerc,

This adds targets to build the clang
man page, as in the corresponding Makefile.
The output is used in Debian packaging,
which is currently stuck using autotools.

http://reviews.llvm.org/D10304

Files:
  docs/CMakeLists.txt
  docs/tools/CMakeLists.txt

Index: docs/CMakeLists.txt
===================================================================
--- docs/CMakeLists.txt
+++ docs/CMakeLists.txt
@@ -1,3 +1,4 @@
+add_subdirectory(tools)
 
 if (DOXYGEN_FOUND)
 if (LLVM_ENABLE_DOXYGEN)
Index: docs/tools/CMakeLists.txt
===================================================================
--- /dev/null
+++ docs/tools/CMakeLists.txt
@@ -0,0 +1,58 @@
+llvm_find_program(POD2HTML NAMES pod2html)
+if (HAVE_POD2HTML)
+  add_custom_command(
+    OUTPUT clang.html
+    DEPENDS clang.pod
+    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+    COMMENT "Rendering clang man page as HTML." VERBATIM
+    COMMAND
+    ${POD2HTML} --css=${CMAKE_CURRENT_SOURCE_DIR}/manpage.css
+                 --podpath=.
+                 --htmlroot=.
+                 --infile=${CMAKE_CURRENT_SOURCE_DIR}/clang.pod
+                 --outfile=clang.html
+                 --title=clang
+  )
+  add_custom_target(clang-man-html ALL DEPENDS clang.html)
+  if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/clang.html
+            DESTINATION share/man)
+  endif()
+endif()
+
+llvm_find_program(POD2MAN NAMES pod2man)
+if (HAVE_POD2MAN)
+  add_custom_command(
+    OUTPUT clang.1
+    DEPENDS clang.pod
+    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+    COMMENT "Rendering clang man page." VERBATIM
+    COMMAND
+    ${POD2MAN} "--release=clang ${CLANG_VERSION}"
+               "--center=Clang Tools Documentation"
+               ${CMAKE_CURRENT_SOURCE_DIR}/clang.pod > clang.1
+  )
+  add_custom_target(clang-man ALL DEPENDS clang.1)
+  if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/clang.1
+            DESTINATION share/man)
+  endif()
+
+  llvm_find_program(GROFF NAMES groff)
+  if (HAVE_GROFF)
+    add_custom_command(
+      OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/clang.ps
+      DEPENDS clang.1
+      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+      COMMENT "Rendering clang man page as postscript." VERBATIM
+      COMMAND
+      ${GROFF} -Tps -man clang.1 > clang.ps
+    )
+    add_custom_target(clang-man-ps ALL DEPENDS clang.ps)
+    if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+      install(FILES ${CMAKE_CURRENT_BINARY_DIR}/clang.ps
+              DESTINATION share/man)
+    endif()
+  endif()
+endif()
+

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10304.27283.patch
Type: text/x-patch
Size: 2315 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150608/3a1cbea0/attachment.bin>


More information about the cfe-commits mailing list