Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -86,6 +86,11 @@ option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF) + # Ensure that LLVM_ENABLE_LIBXML2 is set for standalone builds + if(NOT DEFINED LLVM_ENABLE_LIBXML2) + set(LLVM_ENABLE_LIBXML2 "ON" CACHE STRING "Use libxml2 if available. Can be ON, OFF, or FORCE_ON") + endif() + option(LLVM_FORCE_USE_OLD_HOST_TOOLCHAIN "Set to ON to force using an old, unsupported host toolchain." OFF) option(CLANG_ENABLE_BOOTSTRAP "Generate the clang bootstrap target" OFF) @@ -186,7 +191,7 @@ # Don't look for libxml if we're using MSan, since uninstrumented third party # code may call MSan interceptors like strlen, leading to false positives. -if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*") +if((LLVM_ENABLE_LIBXML2) AND (NOT LLVM_USE_SANITIZER MATCHES "Memory.*")) set (LIBXML2_FOUND 0) find_package(LibXml2 2.5.3 QUIET) if (LIBXML2_FOUND) @@ -194,6 +199,10 @@ endif() endif() +if (LLVM_ENABLE_LIBXML2 STREQUAL "FORCE_ON" AND NOT CLANG_HAVE_LIBXML) + message(FATAL_ERROR "Failed to configure libxml2") +endif() + include(CheckIncludeFile) check_include_file(sys/resource.h CLANG_HAVE_RLIMITS)