[Lldb-commits] [PATCH] D71306: [RFC] Change how we deal with optional dependencies

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 19 14:40:26 PST 2019


JDevlieghere updated this revision to Diff 234788.
JDevlieghere marked an inline comment as done.
JDevlieghere added a comment.

- Extract finding curses and panel into FindCursesAndPanel
- Include LZMA


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71306/new/

https://reviews.llvm.org/D71306

Files:
  lldb/cmake/modules/FindCursesAndPanel.cmake
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/test/CMakeLists.txt


Index: lldb/test/CMakeLists.txt
===================================================================
--- lldb/test/CMakeLists.txt
+++ lldb/test/CMakeLists.txt
@@ -144,6 +144,7 @@
 # These values are not canonicalized within LLVM.
 llvm_canonicalize_cmake_booleans(
   LLDB_ENABLE_PYTHON
+  LLDB_ENABLE_LZMA
   LLVM_ENABLE_ZLIB
   LLVM_ENABLE_SHARED_LIBS
   LLDB_IS_64_BITS)
Index: lldb/cmake/modules/LLDBConfig.cmake
===================================================================
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -25,7 +25,7 @@
 endif()
 
 function(add_optional_dependency variable description package found)
-  set(${variable} "AUTO" CACHE STRING "${description} On, Off or Auto (default)")
+  set(${variable} "Auto" CACHE STRING "${description} On, Off or Auto (default)")
   string(TOUPPER "${${variable}}" ${variable})
 
   if("${${variable}}" STREQUAL "AUTO")
@@ -38,17 +38,12 @@
   endif()
 
   find_package(${package} ${maybe_required})
-  # We could set ${variable} directory to ${${found}} but then the value is
-  # TRUE/FALSE rather than ON/OFF.
-  if (${${found}})
-    set(${variable} ON PARENT_SCOPE)
-  else()
-    set(${variable} OFF PARENT_SCOPE)
-  endif()
+  set(${variable} ${${found}} PARENT_SCOPE)
 endfunction()
 
 add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support." LibEdit libedit_FOUND)
-add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support." Curses CURSES_FOUND)
+add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support." CursesAndPanel CURSES_PANEL_FOUND)
+add_optional_dependency(LLDB_ENABLE_LZMA "Enable LZMA compression support." LibLZMA LIBLZMA_FOUND)
 
 set(default_enable_python ON)
 
@@ -406,12 +401,9 @@
 set(LLDB_VERSION "${LLDB_VERSION_MAJOR}.${LLDB_VERSION_MINOR}.${LLDB_VERSION_PATCH}${LLDB_VERSION_SUFFIX}")
 message(STATUS "LLDB version: ${LLDB_VERSION}")
 
-find_package(LibLZMA)
-cmake_dependent_option(LLDB_ENABLE_LZMA "Support LZMA compression" ON "LIBLZMA_FOUND" OFF)
 if (LLDB_ENABLE_LZMA)
   include_directories(${LIBLZMA_INCLUDE_DIRS})
 endif()
-llvm_canonicalize_cmake_booleans(LLDB_ENABLE_LZMA)
 
 include_directories(BEFORE
   ${CMAKE_CURRENT_BINARY_DIR}/include
Index: lldb/cmake/modules/FindCursesAndPanel.cmake
===================================================================
--- /dev/null
+++ lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -0,0 +1,16 @@
+#.rst:
+# FindCursesAndPanel
+# -----------
+#
+# Find the curses and panel library as a whole.
+
+if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
+  set(CURSES_PANEL_FOUND TRUE)
+else()
+  find_package(Curses QUIET)
+  find_library(PANEL_LIBRARIES NAMES panel DOC "The curses panel library" QUIET)
+  if(CURSES_FOUND AND PANEL_LIBRARIES)
+    mark_as_advanced(CURSES_INCLUDE_DIRS CURSES_LIBRARIES PANEL_LIBRARIES)
+  endif()
+endif()
+


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71306.234788.patch
Type: text/x-patch
Size: 2865 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191219/15fcfb32/attachment.bin>


More information about the lldb-commits mailing list