Skip to content

Commit df239a6

Browse files
committed
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
1 parent d811196 commit df239a6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

clang/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,12 @@ list(INSERT CMAKE_MODULE_PATH 0
147147
"${LLVM_COMMON_CMAKE_UTILS}/Modules"
148148
)
149149

150-
if(LLVM_ENABLE_LIBXML2)
150+
# This allows disabling clang's XML dependency even if LLVM finds libxml2.
151+
# By default, clang depends on libxml2 if LLVM does.
152+
option(CLANG_ENABLE_LIBXML2 "Whether libclang may depend on libxml2"
153+
${LLVM_ENABLE_LIBXML2})
154+
155+
if(CLANG_ENABLE_LIBXML2)
151156
# Don't look for libxml if we're using MSan, since uninstrumented third party
152157
# code may call MSan interceptors like strlen, leading to false positives.
153158
if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")

0 commit comments

Comments
 (0)