[lldb] [utils] Fix linking lit-cpuid to LLVM dylib
authorMichał Górny <mgorny@gentoo.org>
Mon, 26 Dec 2022 13:30:35 +0000 (14:30 +0100)
committerMichał Górny <mgorny@gentoo.org>
Mon, 26 Dec 2022 18:03:25 +0000 (19:03 +0100)
Use `LINK_COMPONENTS` instead of manual `target_link_libraries` to link
lit-cpuid to LLVM components.  This ensures that dylib is used along
with `LLVM_LINK_LLVM_DYLIB` rather than linking to component libraries
that may not be installed.

This fixes build failure on Gentoo after a dep on TargetParser component
was added in f09cf34d00625e57dea5317a3ac0412c07292148.

Differential Revision: https://reviews.llvm.org/D140671

lldb/utils/lit-cpuid/CMakeLists.txt

index 630e81eaab09b6666d46fcaf8588748464e8d7f4..a151b986b551eca82872f4599ff8a9174df73983 100644 (file)
@@ -1,6 +1,9 @@
 add_lldb_executable(lit-cpuid
   lit-cpuid.cpp
+
+  LINK_COMPONENTS
+    Support
+    TargetParser
   )
 
-target_link_libraries(lit-cpuid PRIVATE LLVMSupport LLVMTargetParser)
 set_target_properties(lit-cpuid PROPERTIES FOLDER "lldb utils")