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 )