[PATCH] D115568: [lld] Use `GNUInstallDirs` to support custom installation dirs.
John Ericson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 10 19:15:05 PST 2021
Ericson2314 created this revision.
Herald added a subscriber: mgorny.
Ericson2314 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Extracted from D99484 <https://reviews.llvm.org/D99484>. My new plan is to start from the outside and work
inward.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D115568
Files:
lld/CMakeLists.txt
lld/cmake/modules/AddLLD.cmake
lld/tools/lld/CMakeLists.txt
Index: lld/tools/lld/CMakeLists.txt
===================================================================
--- lld/tools/lld/CMakeLists.txt
+++ lld/tools/lld/CMakeLists.txt
@@ -20,7 +20,7 @@
)
install(TARGETS lld
- RUNTIME DESTINATION bin)
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
if(NOT LLD_SYMLINKS_TO_CREATE)
set(LLD_SYMLINKS_TO_CREATE
Index: lld/cmake/modules/AddLLD.cmake
===================================================================
--- lld/cmake/modules/AddLLD.cmake
+++ lld/cmake/modules/AddLLD.cmake
@@ -1,3 +1,4 @@
+include(GNUInstallDirs)
include(LLVMDistributionSupport)
macro(add_lld_library name)
@@ -19,7 +20,7 @@
${export_to_lldtargets}
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- RUNTIME DESTINATION bin)
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
add_llvm_install_targets(install-${name}
@@ -46,7 +47,7 @@
get_target_export_arg(${name} LLD export_to_lldtargets)
install(TARGETS ${name}
${export_to_lldtargets}
- RUNTIME DESTINATION bin
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT ${name})
if(NOT CMAKE_CONFIGURATION_TYPES)
Index: lld/CMakeLists.txt
===================================================================
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -1,4 +1,10 @@
# Check if lld is built as a standalone project.
+if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ project(lld)
+endif()
+
+include(GNUInstallDirs)
+
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
project(lld)
cmake_minimum_required(VERSION 3.13.4)
@@ -188,7 +194,7 @@
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
install(DIRECTORY include/
- DESTINATION include
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
FILES_MATCHING
PATTERN "*.h"
)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115568.393651.patch
Type: text/x-patch
Size: 1916 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211211/f7b916b3/attachment.bin>
More information about the llvm-commits
mailing list