[lld] [lld] enable installing lld headers as part of distribution (PR #127123)

Maksim Levental via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 13 12:46:45 PST 2025


https://github.com/makslevental created https://github.com/llvm/llvm-project/pull/127123

Currently if one does

```
set(LLVM_DISTRIBUTION_COMPONENTS
    lld
    lld-cmake-exports
)
```

and then `ninja install-distribution` one does not get an `dist/include/lld` folder.

This PR fixes that.

>From 88477db5cce3cba1856c8cd92a6cbeeff510784a Mon Sep 17 00:00:00 2001
From: Maksim Levental <maksim.levental at gmail.com>
Date: Thu, 13 Feb 2025 15:44:47 -0500
Subject: [PATCH] [lld] enable installing lld headers as part of distribution

---
 lld/CMakeLists.txt | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index 64c9f23805509..7beea1e15296e 100644
--- a/lld/CMakeLists.txt
+++ b/lld/CMakeLists.txt
@@ -180,12 +180,21 @@ include_directories(BEFORE
   ${CMAKE_CURRENT_SOURCE_DIR}/include
   )
 
+add_custom_target(lld-headers)
+set_target_properties(lld-headers PROPERTIES FOLDER "Misc")
 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-  install(DIRECTORY include/
+  install(DIRECTORY include/lld
     DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
+    COMPONENT lld-headers
     FILES_MATCHING
     PATTERN "*.h"
     )
+
+  if (NOT LLVM_ENABLE_IDE)
+    add_llvm_install_targets(install-lld-headers
+                             DEPENDS lld-headers
+                             COMPONENT lld-headers)
+  endif()
 endif()
 
 add_subdirectory(Common)



More information about the llvm-commits mailing list