[Lldb-commits] [PATCH] D72290: [lldb/CMake] Use LLDB's autodetection logic for libxml2
Jonas Devlieghere via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Jan 8 09:06:06 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbbbbf8a1065e: [lldb/CMake] Use LLDB's autodetection logic for libxml2 (authored by JDevlieghere).
Changed prior to commit:
https://reviews.llvm.org/D72290?vs=236721&id=236844#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72290/new/
https://reviews.llvm.org/D72290
Files:
lldb/cmake/modules/LLDBConfig.cmake
lldb/docs/resources/build.rst
Index: lldb/docs/resources/build.rst
===================================================================
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -58,6 +58,8 @@
+-------------------+------------------------------------------------------+--------------------------+
| LZMA | Lossless data compression | ``LLDB_ENABLE_LZMA`` |
+-------------------+------------------------------------------------------+--------------------------+
+| Libxml2 | XML | ``LLDB_ENABLE_LIBXML2`` |
++-------------------+------------------------------------------------------+--------------------------+
| Python | Python scripting | ``LLDB_ENABLE_PYTHON`` |
+-------------------+------------------------------------------------------+--------------------------+
| Lua | Lua scripting | ``LLDB_ENABLE_LUA`` |
Index: lldb/cmake/modules/LLDBConfig.cmake
===================================================================
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -25,6 +25,12 @@
endif()
macro(add_optional_dependency variable description package found)
+ cmake_parse_arguments(ARG
+ ""
+ "VERSION"
+ ""
+ ${ARGN})
+
set(${variable} "Auto" CACHE STRING "${description} On, Off or Auto (default)")
string(TOUPPER "${${variable}}" ${variable})
@@ -40,7 +46,7 @@
endif()
if(${find_package})
- find_package(${package} ${maybe_required})
+ find_package(${package} ${ARG_VERSION} ${maybe_required})
set(${variable} "${${found}}")
endif()
@@ -52,6 +58,7 @@
add_optional_dependency(LLDB_ENABLE_LZMA "Enable LZMA compression support in LLDB" LibLZMA LIBLZMA_FOUND)
add_optional_dependency(LLDB_ENABLE_LUA "Enable Lua scripting support in LLDB" Lua LUA_FOUND)
add_optional_dependency(LLDB_ENABLE_PYTHON "Enable Python scripting support in LLDB" PythonInterpAndLibs PYTHONINTERPANDLIBS_FOUND)
+add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" LibXml2 LIBXML2_FOUND VERSION 2.8)
option(LLDB_RELOCATABLE_PYTHON "Use the PYTHONHOME environment variable to locate Python." OFF)
option(LLDB_USE_SYSTEM_SIX "Use six.py shipped with system and do not install a copy of it" OFF)
@@ -218,6 +225,11 @@
include_directories(${LIBLZMA_INCLUDE_DIRS})
endif()
+if (LLDB_ENABLE_LIBXML2)
+ list(APPEND system_libs ${LIBXML2_LIBRARIES})
+ include_directories(${LIBXML2_INCLUDE_DIR})
+endif()
+
include_directories(BEFORE
${CMAKE_CURRENT_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/include
@@ -251,11 +263,7 @@
endif()
endif()
-if (NOT LIBXML2_FOUND)
- find_package(LibXml2)
-endif()
-
-# Find libraries or frameworks that may be needed
+# Find Apple-specific libraries or frameworks that may be needed.
if (APPLE)
if(NOT IOS)
find_library(CARBON_LIBRARY Carbon)
@@ -264,18 +272,13 @@
find_library(FOUNDATION_LIBRARY Foundation)
find_library(CORE_FOUNDATION_LIBRARY CoreFoundation)
find_library(SECURITY_LIBRARY Security)
- set(LLDB_ENABLE_LIBXML2 ON)
- list(APPEND system_libs xml2
+ list(APPEND system_libs
${FOUNDATION_LIBRARY}
${CORE_FOUNDATION_LIBRARY}
${CORE_SERVICES_LIBRARY}
${SECURITY_LIBRARY}
${DEBUG_SYMBOLS_LIBRARY})
include_directories(${LIBXML2_INCLUDE_DIR})
-elseif(LIBXML2_FOUND AND LIBXML2_VERSION_STRING VERSION_GREATER 2.8)
- set(LLDB_ENABLE_LIBXML2 ON)
- list(APPEND system_libs ${LIBXML2_LIBRARIES})
- include_directories(${LIBXML2_INCLUDE_DIR})
endif()
if( WIN32 AND NOT CYGWIN )
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72290.236844.patch
Type: text/x-patch
Size: 3715 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200108/5cc38363/attachment.bin>
More information about the lldb-commits
mailing list