[PATCH] D45234: CMake: Check LLVM_ENABLE_LIBXML2 in clang
Stephen Crane via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 3 15:52:31 PDT 2018
rinon created this revision.
rinon added reviewers: hans, rnk.
Herald added subscribers: cfe-commits, mgorny.
If LLVM_ENABLE_LIBXML2=OFF, we should not attempt to link clang against
libxml2.
Repository:
rC Clang
https://reviews.llvm.org/D45234
Files:
CMakeLists.txt
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,14 +191,18 @@
# 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)
set(CLANG_HAVE_LIBXML 1)
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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45234.140875.patch
Type: text/x-patch
Size: 1326 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180403/54116ca6/attachment.bin>
More information about the cfe-commits
mailing list