249 lines
9.4 KiB
Diff
249 lines
9.4 KiB
Diff
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||
|
index dc1413f4b597..c173531e624f 100644
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -9,6 +9,8 @@ endif()
|
||
|
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
|
||
|
project(Clang)
|
||
|
|
||
|
+ include(GNUInstallDirs)
|
||
|
+
|
||
|
# Rely on llvm-config.
|
||
|
set(CONFIG_OUTPUT)
|
||
|
if(LLVM_CONFIG)
|
||
|
@@ -417,7 +419,7 @@ include_directories(BEFORE
|
||
|
|
||
|
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||
|
install(DIRECTORY include/clang include/clang-c
|
||
|
- DESTINATION include
|
||
|
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||
|
COMPONENT clang-headers
|
||
|
FILES_MATCHING
|
||
|
PATTERN "*.def"
|
||
|
@@ -427,7 +429,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||
|
)
|
||
|
|
||
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang
|
||
|
- DESTINATION include
|
||
|
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||
|
COMPONENT clang-headers
|
||
|
FILES_MATCHING
|
||
|
PATTERN "CMakeFiles" EXCLUDE
|
||
|
@@ -447,7 +449,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||
|
|
||
|
add_custom_target(bash-autocomplete DEPENDS utils/bash-autocomplete.sh)
|
||
|
install(PROGRAMS utils/bash-autocomplete.sh
|
||
|
- DESTINATION share/clang
|
||
|
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
|
||
|
COMPONENT bash-autocomplete)
|
||
|
if(NOT LLVM_ENABLE_IDE)
|
||
|
add_llvm_install_targets(install-bash-autocomplete
|
||
|
diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
|
||
|
index 577cc11ab015..a4f4481d8442 100644
|
||
|
--- a/cmake/modules/AddClang.cmake
|
||
|
+++ b/cmake/modules/AddClang.cmake
|
||
|
@@ -114,9 +114,9 @@ macro(add_clang_library name)
|
||
|
install(TARGETS ${name}
|
||
|
COMPONENT ${name}
|
||
|
${export_to_clangtargets}
|
||
|
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
|
||
|
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
|
||
|
- RUNTIME DESTINATION bin)
|
||
|
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
|
||
|
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
|
||
|
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||
|
|
||
|
if (NOT LLVM_ENABLE_IDE)
|
||
|
add_llvm_install_targets(install-${name}
|
||
|
@@ -160,7 +160,7 @@ macro(add_clang_tool name)
|
||
|
|
||
|
install(TARGETS ${name}
|
||
|
${export_to_clangtargets}
|
||
|
- RUNTIME DESTINATION bin
|
||
|
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||
|
COMPONENT ${name})
|
||
|
|
||
|
if(NOT LLVM_ENABLE_IDE)
|
||
|
@@ -175,7 +175,7 @@ endmacro()
|
||
|
macro(add_clang_symlink name dest)
|
||
|
add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
|
||
|
# Always generate install targets
|
||
|
- llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
|
||
|
+ llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
|
||
|
endmacro()
|
||
|
|
||
|
function(clang_target_link_libraries target type)
|
||
|
diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
|
||
|
index 85c3124234ad..64c48235d914 100644
|
||
|
--- a/lib/Headers/CMakeLists.txt
|
||
|
+++ b/lib/Headers/CMakeLists.txt
|
||
|
@@ -191,7 +191,7 @@ set_target_properties(clang-resource-headers PROPERTIES
|
||
|
FOLDER "Misc"
|
||
|
RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
|
||
|
|
||
|
-set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
|
||
|
+set(header_install_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
|
||
|
|
||
|
install(
|
||
|
FILES ${files} ${generated_files}
|
||
|
diff --git a/tools/c-index-test/CMakeLists.txt b/tools/c-index-test/CMakeLists.txt
|
||
|
index ceef4b08637c..8efad5520ca4 100644
|
||
|
--- a/tools/c-index-test/CMakeLists.txt
|
||
|
+++ b/tools/c-index-test/CMakeLists.txt
|
||
|
@@ -54,7 +54,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||
|
set_property(TARGET c-index-test APPEND PROPERTY INSTALL_RPATH
|
||
|
"@executable_path/../../lib")
|
||
|
else()
|
||
|
- set(INSTALL_DESTINATION bin)
|
||
|
+ set(INSTALL_DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||
|
endif()
|
||
|
|
||
|
install(TARGETS c-index-test
|
||
|
diff --git a/tools/clang-format/CMakeLists.txt b/tools/clang-format/CMakeLists.txt
|
||
|
index 35ecdb11253c..d77d75de0094 100644
|
||
|
--- a/tools/clang-format/CMakeLists.txt
|
||
|
+++ b/tools/clang-format/CMakeLists.txt
|
||
|
@@ -21,20 +21,20 @@ if( LLVM_LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
|
||
|
endif()
|
||
|
|
||
|
install(PROGRAMS clang-format-bbedit.applescript
|
||
|
- DESTINATION share/clang
|
||
|
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
|
||
|
COMPONENT clang-format)
|
||
|
install(PROGRAMS clang-format-diff.py
|
||
|
- DESTINATION share/clang
|
||
|
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
|
||
|
COMPONENT clang-format)
|
||
|
install(PROGRAMS clang-format-sublime.py
|
||
|
- DESTINATION share/clang
|
||
|
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
|
||
|
COMPONENT clang-format)
|
||
|
install(PROGRAMS clang-format.el
|
||
|
- DESTINATION share/clang
|
||
|
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
|
||
|
COMPONENT clang-format)
|
||
|
install(PROGRAMS clang-format.py
|
||
|
- DESTINATION share/clang
|
||
|
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
|
||
|
COMPONENT clang-format)
|
||
|
install(PROGRAMS git-clang-format
|
||
|
- DESTINATION bin
|
||
|
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||
|
COMPONENT clang-format)
|
||
|
diff --git a/tools/clang-rename/CMakeLists.txt b/tools/clang-rename/CMakeLists.txt
|
||
|
index cda8e29ec5b1..0134d8ccd70b 100644
|
||
|
--- a/tools/clang-rename/CMakeLists.txt
|
||
|
+++ b/tools/clang-rename/CMakeLists.txt
|
||
|
@@ -19,8 +19,8 @@ clang_target_link_libraries(clang-rename
|
||
|
)
|
||
|
|
||
|
install(PROGRAMS clang-rename.py
|
||
|
- DESTINATION share/clang
|
||
|
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
|
||
|
COMPONENT clang-rename)
|
||
|
install(PROGRAMS clang-rename.el
|
||
|
- DESTINATION share/clang
|
||
|
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
|
||
|
COMPONENT clang-rename)
|
||
|
diff --git a/tools/diagtool/CMakeLists.txt b/tools/diagtool/CMakeLists.txt
|
||
|
index a95444be40ee..136d96d9bf5b 100644
|
||
|
--- a/tools/diagtool/CMakeLists.txt
|
||
|
+++ b/tools/diagtool/CMakeLists.txt
|
||
|
@@ -21,7 +21,7 @@ clang_target_link_libraries(diagtool
|
||
|
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||
|
install(TARGETS diagtool
|
||
|
COMPONENT diagtool
|
||
|
- RUNTIME DESTINATION bin)
|
||
|
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||
|
|
||
|
if (NOT LLVM_ENABLE_IDE)
|
||
|
add_llvm_install_targets(install-diagtool
|
||
|
diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
|
||
|
index 973655361f71..0181002e4e3b 100644
|
||
|
--- a/tools/libclang/CMakeLists.txt
|
||
|
+++ b/tools/libclang/CMakeLists.txt
|
||
|
@@ -141,7 +141,7 @@ endif()
|
||
|
if(INTERNAL_INSTALL_PREFIX)
|
||
|
set(LIBCLANG_HEADERS_INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/include")
|
||
|
else()
|
||
|
- set(LIBCLANG_HEADERS_INSTALL_DESTINATION include)
|
||
|
+ set(LIBCLANG_HEADERS_INSTALL_DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||
|
endif()
|
||
|
|
||
|
install(DIRECTORY ../../include/clang-c
|
||
|
@@ -172,7 +172,7 @@ foreach(PythonVersion ${CLANG_PYTHON_BINDINGS_VERSIONS})
|
||
|
COMPONENT
|
||
|
libclang-python-bindings
|
||
|
DESTINATION
|
||
|
- "lib${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
|
||
|
+ "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
|
||
|
endforeach()
|
||
|
if(NOT LLVM_ENABLE_IDE)
|
||
|
add_custom_target(libclang-python-bindings)
|
||
|
diff --git a/tools/scan-build/CMakeLists.txt b/tools/scan-build/CMakeLists.txt
|
||
|
index 28241245fcb7..d6b59f02fc2a 100644
|
||
|
--- a/tools/scan-build/CMakeLists.txt
|
||
|
+++ b/tools/scan-build/CMakeLists.txt
|
||
|
@@ -42,7 +42,7 @@ if(CLANG_INSTALL_SCANBUILD)
|
||
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
|
||
|
list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
|
||
|
install(PROGRAMS bin/${BinFile}
|
||
|
- DESTINATION bin
|
||
|
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||
|
COMPONENT scan-build)
|
||
|
endforeach()
|
||
|
|
||
|
@@ -56,7 +56,7 @@ if(CLANG_INSTALL_SCANBUILD)
|
||
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile})
|
||
|
list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile})
|
||
|
install(PROGRAMS libexec/${LibexecFile}
|
||
|
- DESTINATION libexec
|
||
|
+ DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}
|
||
|
COMPONENT scan-build)
|
||
|
endforeach()
|
||
|
|
||
|
@@ -84,7 +84,7 @@ if(CLANG_INSTALL_SCANBUILD)
|
||
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile})
|
||
|
list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile})
|
||
|
install(FILES share/scan-build/${ShareFile}
|
||
|
- DESTINATION share/scan-build
|
||
|
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-build
|
||
|
COMPONENT scan-build)
|
||
|
endforeach()
|
||
|
|
||
|
diff --git a/tools/scan-view/CMakeLists.txt b/tools/scan-view/CMakeLists.txt
|
||
|
index 22edb974bac7..9f140a9a4538 100644
|
||
|
--- a/tools/scan-view/CMakeLists.txt
|
||
|
+++ b/tools/scan-view/CMakeLists.txt
|
||
|
@@ -22,7 +22,7 @@ if(CLANG_INSTALL_SCANVIEW)
|
||
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
|
||
|
list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
|
||
|
install(PROGRAMS bin/${BinFile}
|
||
|
- DESTINATION bin
|
||
|
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||
|
COMPONENT scan-view)
|
||
|
endforeach()
|
||
|
|
||
|
@@ -36,7 +36,7 @@ if(CLANG_INSTALL_SCANVIEW)
|
||
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
|
||
|
list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
|
||
|
install(FILES share/${ShareFile}
|
||
|
- DESTINATION share/scan-view
|
||
|
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-view
|
||
|
COMPONENT scan-view)
|
||
|
endforeach()
|
||
|
|
||
|
diff --git a/utils/hmaptool/CMakeLists.txt b/utils/hmaptool/CMakeLists.txt
|
||
|
index 62f2de0cb15c..6aa66825b6ec 100644
|
||
|
--- a/utils/hmaptool/CMakeLists.txt
|
||
|
+++ b/utils/hmaptool/CMakeLists.txt
|
||
|
@@ -10,7 +10,7 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HM
|
||
|
|
||
|
list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL})
|
||
|
install(PROGRAMS ${CLANG_HMAPTOOL}
|
||
|
- DESTINATION bin
|
||
|
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||
|
COMPONENT hmaptool)
|
||
|
|
||
|
add_custom_target(hmaptool ALL DEPENDS ${Depends})
|