[Lldb-commits] [lldb] ff82315 - [lldb/CMake] Simplify linking against curses

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 11 14:36:39 PST 2019


Author: Jonas Devlieghere
Date: 2019-12-11T14:36:32-08:00
New Revision: ff82315d4ec0fc96a8c581e1c9252a15bc0adaf3

URL: https://github.com/llvm/llvm-project/commit/ff82315d4ec0fc96a8c581e1c9252a15bc0adaf3
DIFF: https://github.com/llvm/llvm-project/commit/ff82315d4ec0fc96a8c581e1c9252a15bc0adaf3.diff

LOG: [lldb/CMake] Simplify linking against curses

Centralize the logic to determine what libraries to link against for
curses in the CMake file where it is actually being used. Use
target_include_directories instead of include_directories.

Added: 
    

Modified: 
    lldb/cmake/modules/LLDBConfig.cmake
    lldb/source/Core/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index 8eb72ba44114..8d5c5fc08cfa 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -445,7 +445,6 @@ if (APPLE)
   find_library(SECURITY_LIBRARY Security)
   set(LLDB_ENABLE_LIBXML2 ON)
   list(APPEND system_libs xml2
-       ${CURSES_LIBRARIES}
        ${FOUNDATION_LIBRARY}
        ${CORE_FOUNDATION_LIBRARY}
        ${CORE_SERVICES_LIBRARY}
@@ -488,17 +487,10 @@ endif()
 
 if (NOT LLDB_DISABLE_CURSES)
     find_package(Curses REQUIRED)
-
     find_library(CURSES_PANEL_LIBRARY NAMES panel DOC "The curses panel library")
     if (NOT CURSES_PANEL_LIBRARY)
         message(FATAL_ERROR "A required curses' panel library not found.")
     endif ()
-
-    # Add panels to the library path
-    set (CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_PANEL_LIBRARY})
-
-    list(APPEND system_libs ${CURSES_LIBRARIES})
-    include_directories(${CURSES_INCLUDE_DIR})
 endif ()
 
 if ((CMAKE_SYSTEM_NAME MATCHES "Android") AND LLVM_BUILD_STATIC AND

diff  --git a/lldb/source/Core/CMakeLists.txt b/lldb/source/Core/CMakeLists.txt
index a6f7ba8dc25b..0c7f3e376df7 100644
--- a/lldb/source/Core/CMakeLists.txt
+++ b/lldb/source/Core/CMakeLists.txt
@@ -10,7 +10,7 @@ set(LLDB_CURSES_LIBS)
 set(LLDB_LIBEDIT_LIBS)
 
 if (NOT LLDB_DISABLE_CURSES)
-  list(APPEND LLDB_CURSES_LIBS ${CURSES_LIBRARIES})
+  list(APPEND LLDB_CURSES_LIBS ${CURSES_LIBRARIES} ${CURSES_PANEL_LIBRARY})
   if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO)
     list(APPEND LLDB_CURSES_LIBS ${TERMINFO_LIBS})
   endif()
@@ -101,3 +101,7 @@ set_target_properties(lldbCore PROPERTIES LINK_INTERFACE_MULTIPLICITY 4)
 if (NOT LLDB_DISABLE_LIBEDIT)
   target_include_directories(lldbCore PRIVATE ${libedit_INCLUDE_DIRS})
 endif()
+
+if (NOT LLDB_DISABLE_CURSES)
+  target_include_directories(lldbCore PRIVATE ${CURSES_INCLUDE_DIR})
+endif()


        


More information about the lldb-commits mailing list