@ -1,5 +1,5 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e5febba8043c..3cf530c341b0 100644
index 135036f509d2..265c36f8211b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -270,15 +270,21 @@ if (CMAKE_BUILD_TYPE AND
@ -37,7 +37,7 @@ index e5febba8043c..3cf530c341b0 100644
CACHE STRING "OCamldoc-generated HTML documentation install directory")
option (LLVM_BUILD_EXTERNAL_COMPILER_RT
@@ -1046,7 +1052 ,7 @@ endif()
@@ -1048,7 +1054 ,7 @@ endif()
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
install(DIRECTORY include/llvm include/llvm-c
@ -46,7 +46,7 @@ index e5febba8043c..3cf530c341b0 100644
COMPONENT llvm-headers
FILES_MATCHING
PATTERN "*.def"
@@ -1057,7 +1063 ,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
@@ -1059,7 +1065 ,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
)
install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm ${LLVM_INCLUDE_DIR}/llvm-c
@ -55,7 +55,7 @@ index e5febba8043c..3cf530c341b0 100644
COMPONENT llvm-headers
FILES_MATCHING
PATTERN "*.def"
@@ -1071,13 +1077 ,13 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
@@ -1073,13 +1079 ,13 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
if (LLVM_INSTALL_MODULEMAPS)
install(DIRECTORY include/llvm include/llvm-c
@ -72,10 +72,10 @@ index e5febba8043c..3cf530c341b0 100644
RENAME "module.extern.modulemap"
)
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index 1c419cddbe93..fa0be670986 b 100644
index 9c2b85374307..5531ceeb2ee b 100644
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -80 1,9 +80 1,9 @@ macro(add_llvm_library name)
@@ -818 ,9 +818 ,9 @@ macro(add_llvm_library name)
get_target_export_arg(${name} LLVM export_to_llvmexports ${umbrella})
install(TARGETS ${name}
${export_to_llvmexports}
@ -88,7 +88,7 @@ index 1c419cddbe93..fa0be670986b 100644
if (NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-${name}
@@ -1019,7 +1019 ,7 @@ function(process_llvm_pass_plugins)
@@ -1036,7 +1036 ,7 @@ function(process_llvm_pass_plugins)
"set(LLVM_STATIC_EXTENSIONS ${LLVM_STATIC_EXTENSIONS})")
install(FILES
${llvm_cmake_builddir}/LLVMConfigExtensions.cmake
@ -97,7 +97,7 @@ index 1c419cddbe93..fa0be670986b 100644
COMPONENT cmake-exports)
set(ExtensionDef "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def")
@@ -1233,7 +1233 ,7 @@ macro(add_llvm_example name)
@@ -1250,7 +1250 ,7 @@ macro(add_llvm_example name)
endif()
add_llvm_executable(${name} ${ARGN})
if( LLVM_BUILD_EXAMPLES )
@ -106,7 +106,7 @@ index 1c419cddbe93..fa0be670986b 100644
endif()
set_target_properties(${name} PROPERTIES FOLDER "Examples")
endmacro(add_llvm_example name)
@@ -1851,7 +1851 ,7 @@ function(llvm_install_library_symlink name dest type)
@@ -1868,7 +1868 ,7 @@ function(llvm_install_library_symlink name dest type)
set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX})
set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX})
@ -115,7 +115,7 @@ index 1c419cddbe93..fa0be670986b 100644
if(WIN32 AND "${type}" STREQUAL "SHARED")
set(output_dir bin)
endif()
@@ -1862,7 +1862 ,7 @@ function(llvm_install_library_symlink name dest type)
@@ -1879,7 +1879 ,7 @@ function(llvm_install_library_symlink name dest type)
endfunction()
@ -124,7 +124,7 @@ index 1c419cddbe93..fa0be670986b 100644
cmake_parse_arguments(ARG "ALWAYS_GENERATE" "COMPONENT" "" ${ARGN})
foreach(path ${CMAKE_MODULE_PATH})
if(EXISTS ${path}/LLVMInstallSymlink.cmake)
@@ -1885,7 +1885 ,7 @@ function(llvm_install_symlink name dest)
@@ -1902,7 +1902 ,7 @@ function(llvm_install_symlink name dest)
set(full_dest ${dest}${CMAKE_EXECUTABLE_SUFFIX})
install(SCRIPT ${INSTALL_SYMLINK}
@ -133,7 +133,7 @@ index 1c419cddbe93..fa0be670986b 100644
COMPONENT ${component})
if (NOT LLVM_ENABLE_IDE AND NOT ARG_ALWAYS_GENERATE)
@@ -196 8,7 +196 8,8 @@ function(add_llvm_tool_symlink link_name target)
@@ -1985 ,7 +1985 ,8 @@ function(add_llvm_tool_symlink link_name target)
endif()
if ((TOOL_IS_TOOLCHAIN OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) AND LLVM_BUILD_TOOLS)
@ -143,7 +143,7 @@ index 1c419cddbe93..fa0be670986b 100644
endif()
endif()
endfunction()
@@ -2097,9 +2098 ,9 @@ function(llvm_setup_rpath name)
@@ -2114,9 +2115 ,9 @@ function(llvm_setup_rpath name)
# Since BUILD_SHARED_LIBS is only recommended for use by developers,
# hardcode the rpath to build/install lib dir first in this mode.
# FIXME: update this when there is better solution.
@ -227,19 +227,19 @@ index 3e6a2c9a2648..52e14d955c60 100644
message(STATUS "Creating ${name}")
diff --git a/docs/CMake.rst b/docs/CMake.rst
index 589b09f28281..af43b082f755 100644
index f1ac2c7d4934..c6e1469b5e13 100644
--- a/docs/CMake.rst
+++ b/docs/CMake.rst
@@ -196,7 +196 ,7 @@ CMake manual, or execute ``cmake --help-variable VARIABLE_NAME``.
@@ -202,7 +202 ,7 @@ CMake manual, or execute ``cmake --help-variable VARIABLE_NAME``.
**LLVM_LIBDIR_SUFFIX**:STRING
Extra suffix to append to the directory where libraries are to be
installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
- to install libraries to ``/usr/lib64``.
+ to install libraries to ``/usr/lib64``. See also ``CMAKE_INSTALL_LIBDIR``.
**CMAKE_C_FLAGS**:STRING
Extra flags to use when compiling C source files.
@@ -555,8 +555 ,8 @@ LLVM-specific variables
Rarely-used CMake variables
---------------------------
@@ -551,8 +551 ,8 @@ LLVM-specific variables
**LLVM_INSTALL_DOXYGEN_HTML_DIR**:STRING
The path to install Doxygen-generated HTML documentation to. This path can
@ -248,47 +248,9 @@ index 589b09f28281..af43b082f755 100644
+ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
+ `${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html`.
**LLVM_ENABLE_SPHINX**:BOOL
If specified, CMake will search for the ``sphinx-build`` executable and will make
@@ -587,13 +587,33 @@ LLVM-specific variables
**LLVM_INSTALL_SPHINX_HTML_DIR**:STRING
The path to install Sphinx-generated HTML documentation to. This path can
- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
- `share/doc/llvm/html`.
+ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
+ `${CMAKE_INSTALL_DOCDIR}/${project}/html`.
**LLVM_INSTALL_OCAMLDOC_HTML_DIR**:STRING
The path to install OCamldoc-generated HTML documentation to. This path can
- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
- `share/doc/llvm/ocaml-html`.
+ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
+ `${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html`.
+
+**CMAKE_INSTALL_BINDIR**:STRING
+ The path to install binary tools, relative to the ``CMAKE_INSTALL_PREFIX``.
+ Defaults to `bin`.
+
+**CMAKE_INSTALL_LIBDIR**:STRING
+ The path to install libraries, relative to the ``CMAKE_INSTALL_PREFIX``.
+ Defaults to `lib`.
+
+**CMAKE_INSTALL_INCLUDEDIR**:STRING
+ The path to install header files, relative to the ``CMAKE_INSTALL_PREFIX``.
+ Defaults to `include`.
+
+**CMAKE_INSTALL_DOCDIR**:STRING
+ The path to install documentation, relative to the ``CMAKE_INSTALL_PREFIX``.
+ Defaults to `share/doc`.
+
+**CMAKE_INSTALL_MANDIR**:STRING
+ The path to install manpage files, relative to the ``CMAKE_INSTALL_PREFIX``.
+ Defaults to `share/man`.
**LLVM_CREATE_XCODE_TOOLCHAIN**:BOOL
macOS Only: If enabled CMake will generate a target named
@@ -791,9 +811,11 @@ the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``).
**LLVM_LINK_LLVM_DYLIB**:BOOL
If enabled, tools will be linked with the libLLVM shared library. Defaults
@@ -792,9 +792,11 @@ the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``).
This file is available in two different locations.
@ -379,11 +341,11 @@ index 1a2f04552d13..44fa7d3eec6b 100644
}
diff --git a/tools/lto/CMakeLists.txt b/tools/lto/CMakeLists.txt
index 2963f97cad88..69d66c9c9ca1 100644
index 0af29ad762c5..37b99b83e35c 100644
--- a/tools/lto/CMakeLists.txt
+++ b/tools/lto/CMakeLists.txt
@@ -25,7 +25,7 @@ add_llvm_library(LTO SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES} DEPENDS
intrinsics_gen)
@@ -33,7 +33,7 @@ add_llvm_library(${LTO_LIBRARY_NAME} ${LTO_LIBRARY_TYPE} INSTALL_WITH_TOOLCHAIN
${SOURCES} DEPENDS intrinsics_gen)
install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
- DESTINATION include/llvm-c