Respect CMAKE_INSTALL_MANDIR for sphinx generated manpages
authorJonathan Roelofs <jonathan@codesourcery.com>
Wed, 5 Apr 2017 14:49:46 +0000 (14:49 +0000)
committerJonathan Roelofs <jonathan@codesourcery.com>
Wed, 5 Apr 2017 14:49:46 +0000 (14:49 +0000)
This is a re-work of r297516, which was reverted in r297545.

https://reviews.llvm.org/D30906

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299547 91177308-0d34-0410-b5e6-96231b3b80d8

cmake/modules/AddSphinxTarget.cmake

index 3456b536e80acc80523a2b733dc86ea9babe1d7b..cfc7f38e9e7776e81f79993b713584de935fbb1a 100644 (file)
@@ -48,10 +48,15 @@ function (add_sphinx_target builder project)
     # Handle installation
     if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
       if (builder STREQUAL man)
+        if (CMAKE_INSTALL_MANDIR)
+          set(INSTALL_MANDIR ${CMAKE_INSTALL_MANDIR}/)
+        else()
+          set(INSTALL_MANDIR share/man/)
+        endif()
         # FIXME: We might not ship all the tools that these man pages describe
         install(DIRECTORY "${SPHINX_BUILD_DIR}/" # Slash indicates contents of
                 COMPONENT "${project}-sphinx-man"
-                DESTINATION share/man/man1)
+                DESTINATION ${INSTALL_MANDIR}man1)
 
       elseif (builder STREQUAL html)
         string(TOUPPER "${project}" project_upper)