236 lines
9.0 KiB
Diff
236 lines
9.0 KiB
Diff
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||
|
index 9e74014134a0..976e6a1757fd 100644
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -5,6 +5,8 @@ cmake_minimum_required(VERSION 3.13.4)
|
||
|
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
|
||
|
project(Clang)
|
||
|
|
||
|
+ include(GNUInstallDirs)
|
||
|
+
|
||
|
set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
|
||
|
set(CMAKE_CXX_STANDARD_REQUIRED YES)
|
||
|
set(CMAKE_CXX_EXTENSIONS NO)
|
||
|
@@ -416,7 +418,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"
|
||
|
@@ -425,7 +427,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
|
||
|
@@ -445,7 +447,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 704278a0e93b..d25c8d325c71 100644
|
||
|
--- a/cmake/modules/AddClang.cmake
|
||
|
+++ b/cmake/modules/AddClang.cmake
|
||
|
@@ -123,9 +123,9 @@ macro(add_clang_library name)
|
||
|
install(TARGETS ${lib}
|
||
|
COMPONENT ${lib}
|
||
|
${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-${lib}
|
||
|
@@ -170,7 +170,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)
|
||
|
@@ -185,7 +185,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 b2c0ce8dd4a0..19e5443d8c25 100644
|
||
|
--- a/lib/Headers/CMakeLists.txt
|
||
|
+++ b/lib/Headers/CMakeLists.txt
|
||
|
@@ -215,7 +215,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/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
|
||
|
index 51ff2e7e1565..1ed5f8a079a1 100644
|
||
|
--- a/tools/libclang/CMakeLists.txt
|
||
|
+++ b/tools/libclang/CMakeLists.txt
|
||
|
@@ -166,7 +166,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
|
||
|
@@ -196,7 +196,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 ec0702d76f18..d25d982f51da 100644
|
||
|
--- a/tools/scan-build/CMakeLists.txt
|
||
|
+++ b/tools/scan-build/CMakeLists.txt
|
||
|
@@ -47,7 +47,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()
|
||
|
|
||
|
@@ -61,7 +61,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()
|
||
|
|
||
|
@@ -89,7 +89,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 dd3d33439299..fea19c12ce70 100644
|
||
|
--- a/tools/scan-view/CMakeLists.txt
|
||
|
+++ b/tools/scan-view/CMakeLists.txt
|
||
|
@@ -19,7 +19,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()
|
||
|
|
||
|
@@ -33,7 +33,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})
|