[Lldb-commits] [lldb] r311122 - [cmake] Add explicit linkage from Core to curses

Michal Gorny via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 17 13:33:21 PDT 2017


Author: mgorny
Date: Thu Aug 17 13:33:21 2017
New Revision: 311122

URL: http://llvm.org/viewvc/llvm-project?rev=311122&view=rev
Log:
[cmake] Add explicit linkage from Core to curses

The Core library calls functions provided by the curses library. Add
an appropriate explicit LINK_LIBS to ${CURSES_LIBRARIES} to propagate
the dependency correctly within the build system.

It seems that so far the linkage was handled by some kind of implicit
magic LLDB_SYSTEM_LIBS variable. However, it stopped working for
unittests as the curses libraries are passed before the LLDBCore
library, resulting in `-Wl,--as-needed` stripping the yet-unused library
before it is required by LLDBCore, and effectively breaking the build.
I think it's better to focus on listing all the dependencies explicitly
and let CMake propagate them rather than trying to figure out why this
hack stopped working.

This is also more consistent with LLVM where the curses linkage
in LLVMSupport is expressed directly in the library rather than deferred
to the final programs.

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

Modified:
    lldb/trunk/source/Core/CMakeLists.txt

Modified: lldb/trunk/source/Core/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/CMakeLists.txt?rev=311122&r1=311121&r2=311122&view=diff
==============================================================================
--- lldb/trunk/source/Core/CMakeLists.txt (original)
+++ lldb/trunk/source/Core/CMakeLists.txt Thu Aug 17 13:33:21 2017
@@ -1,3 +1,12 @@
+set(LLDB_CURSES_LIBS)
+
+if (NOT LLDB_DISABLE_CURSES)
+  list(APPEND LLDB_CURSES_LIBS ${CURSES_LIBRARIES})
+  if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO)
+    list(APPEND LLDB_CURSES_LIBS ${TERMINFO_LIBS})
+  endif()
+endif()
+
 add_lldb_library(lldbCore
   Address.cpp
   AddressRange.cpp
@@ -62,6 +71,7 @@ add_lldb_library(lldbCore
     lldbPluginCPlusPlusLanguage
     lldbPluginObjCLanguage
     lldbPluginObjectFileJIT
+    ${LLDB_CURSES_LIBS}
 
   LINK_COMPONENTS
     BinaryFormat




More information about the lldb-commits mailing list