diff options
author | Nico Weber <thakis@chromium.org> | 2022-10-25 13:22:23 -0400 |
---|---|---|
committer | Nico Weber <thakis@chromium.org> | 2022-10-26 13:34:19 -0400 |
commit | df239a6c17fa51274e38f185e72ac02c2f8fb914 (patch) | |
tree | 004efdf52e12a93fae73dc61f1a6777344523dfa /clang/CMakeLists.txt | |
parent | d811196ba6c056c94544431946518090386c83ae (diff) | |
download | llvm-df239a6c17fa51274e38f185e72ac02c2f8fb914.tar.gz |
clang: Add a cmake toggle to disable libclang's libxml2 dependency
By default, libclang will still depend on libxml2 according to
LLVM_ENABLE_LIBXML2, but with this it's possible to make libclang
not depend on libxml2 even though LLVM does.
The motivation is that libclang uses a bigger API surface of libxml2
than LLVM, and we're statically linking a very minimal build of
libxml2 in our LLVM/clang distribution.
Differential Revision: https://reviews.llvm.org/D136700
Diffstat (limited to 'clang/CMakeLists.txt')
-rw-r--r-- | clang/CMakeLists.txt | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index 7c41eadc7bf9..6f590c830b23 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -147,7 +147,12 @@ list(INSERT CMAKE_MODULE_PATH 0 "${LLVM_COMMON_CMAKE_UTILS}/Modules" ) -if(LLVM_ENABLE_LIBXML2) +# This allows disabling clang's XML dependency even if LLVM finds libxml2. +# By default, clang depends on libxml2 if LLVM does. +option(CLANG_ENABLE_LIBXML2 "Whether libclang may depend on libxml2" + ${LLVM_ENABLE_LIBXML2}) + +if(CLANG_ENABLE_LIBXML2) # 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.*") |