Author: Jonas Devlieghere Date: 2020-01-08T09:03:40-08:00 New Revision: bbbbf8a1065e9420e3cc7c958897683e84023075
URL: https://github.com/llvm/llvm-project/commit/bbbbf8a1065e9420e3cc7c958897683e84023075 DIFF: https://github.com/llvm/llvm-project/commit/bbbbf8a1065e9420e3cc7c958897683e84023075.diff LOG: [lldb/CMake] Use LLDB's autodetection logic for libxml2 Libxml2 is already an optional dependency. It should use the same infrastructure as the other dependencies. Differential revision: https://reviews.llvm.org/D72290 Added: Modified: lldb/cmake/modules/LLDBConfig.cmake lldb/docs/resources/build.rst Removed: ################################################################################ diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake index f318b5c8bd2a..c4ec7fd7cd9b 100644 --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -25,6 +25,12 @@ if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darw 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 @@ macro(add_optional_dependency variable description package found) 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_CURSES "Enable curses support in LLDB" Curse 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 @@ if (LLDB_ENABLE_LZMA) 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 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) 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 @@ if (APPLE) 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 ) diff --git a/lldb/docs/resources/build.rst b/lldb/docs/resources/build.rst index ef290892b4fe..41586e22048d 100644 --- a/lldb/docs/resources/build.rst +++ b/lldb/docs/resources/build.rst @@ -58,6 +58,8 @@ CMake configuration error. +-------------------+------------------------------------------------------+--------------------------+ | LZMA | Lossless data compression | ``LLDB_ENABLE_LZMA`` | +-------------------+------------------------------------------------------+--------------------------+ +| Libxml2 | XML | ``LLDB_ENABLE_LIBXML2`` | ++-------------------+------------------------------------------------------+--------------------------+ | Python | Python scripting | ``LLDB_ENABLE_PYTHON`` | +-------------------+------------------------------------------------------+--------------------------+ | Lua | Lua scripting | ``LLDB_ENABLE_LUA`` | _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits