Index: lldb/cmake/modules/FindLibXml28.cmake =================================================================== --- /dev/null +++ lldb/cmake/modules/FindLibXml28.cmake @@ -0,0 +1,27 @@ +#.rst: +# FindLibXml28 +# ----------- +# +# Find a recent version (>2.8) of Libxml2. + +if(LIBXML2_LIBRARIES AND LIBXML2_INCLUDE_DIR) + set(LIBXML28_FOUND TRUE) +else() + find_package(LibXml2 QUIET) + + if(LIBXML2_FOUND AND LIBXML2_VERSION_STRING VERSION_GREATER 2.8) + if (APPLE) + set(LIBXML2_LIBRARIES xml2) + endif() + mark_as_advanced(LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR) + endif() + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(LibXml28 + FOUND_VAR + LIBXML28_FOUND + REQUIRED_VARS + LIBXML2_LIBRARIES + LIBXML2_INCLUDE_DIR) +endif() + Index: lldb/cmake/modules/LLDBConfig.cmake =================================================================== --- lldb/cmake/modules/LLDBConfig.cmake +++ lldb/cmake/modules/LLDBConfig.cmake @@ -52,6 +52,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" LibXml28 LIBXML28_FOUND) 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 +219,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 +257,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 +266,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 )