[llvm] [cmake] Allow multiple LibEdit_LIBRARIES (PR #93896)

Daniel Thornburgh via llvm-commits llvm-commits at lists.llvm.org
Thu May 30 16:39:59 PDT 2024


https://github.com/mysterymath created https://github.com/llvm/llvm-project/pull/93896

If built statically, `libedit` may have a private static library dependency on a provider of the `terminfo` API (e.g., `ncurses`). This means that multiple libraries would need to be provided as the value for `LibEdit_LIBRARIES`, but the current implementation of `FindLibEdit` precludes this. This PR allows a list to be passed to `LibEdit_LIBRARIES`.

>From 2d7f1f393a92525adad9d09bdf5b556229191347 Mon Sep 17 00:00:00 2001
From: Daniel Thornburgh <dthorn at google.com>
Date: Tue, 28 May 2024 14:46:32 -0700
Subject: [PATCH] [cmake] Allow multiple LibEdit_LIBRARIES

---
 llvm/cmake/modules/FindLibEdit.cmake | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/llvm/cmake/modules/FindLibEdit.cmake b/llvm/cmake/modules/FindLibEdit.cmake
index de8f5a2e71013..b3f49e1477f0b 100644
--- a/llvm/cmake/modules/FindLibEdit.cmake
+++ b/llvm/cmake/modules/FindLibEdit.cmake
@@ -59,8 +59,7 @@ find_package_handle_standard_args(LibEdit
 mark_as_advanced(LibEdit_INCLUDE_DIRS LibEdit_LIBRARIES)
 
 if (LibEdit_FOUND AND NOT TARGET LibEdit::LibEdit)
-  add_library(LibEdit::LibEdit UNKNOWN IMPORTED)
-  set_target_properties(LibEdit::LibEdit PROPERTIES
-                        IMPORTED_LOCATION ${LibEdit_LIBRARIES}
-                        INTERFACE_INCLUDE_DIRECTORIES ${LibEdit_INCLUDE_DIRS})
+  add_library(LibEdit::LibEdit INTERFACE IMPORTED)
+  target_link_libraries(LibEdit::LibEdit INTERFACE ${LibEdit_LIBRARIES})
+  target_include_directories(LibEdit::LibEdit INTERFACE ${LibEdit_INCLUDE_DIRS})
 endif()



More information about the llvm-commits mailing list