[PATCH] D106740: [CMake] Add LIBXML2_DEFINITIONS when testing for symbol existance
Markus Böck via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 24 00:26:57 PDT 2021
zero9178 created this revision.
zero9178 added reviewers: MaskRay, phosek, hans.
Herald added a subscriber: mgorny.
zero9178 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Currently when linking LLVM against Libxml2, a simple check is performed to check whether it can be linked successfully. This check currently adds the include directories and the libraries for libxml2, but not definitions found by the config.
This causes issues on Windows when trying to link against a static libxml2. Libxml2 requires `LIBXML_STATIC` to be defined in the preprocessor to be able to link statically. This definition is put into `LIBXML2_DEFINITIONS` in the cmake config, but not properly forwarded to `check_symbol_exists` leading to it failing as it could not find `xmlReadMemory` in a DLL.
This patch simply appends the content of `LIBXML2_DEFINITIONS` to the symbol check definitions, fixing the issue.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D106740
Files:
llvm/cmake/config-ix.cmake
Index: llvm/cmake/config-ix.cmake
===================================================================
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -149,6 +149,7 @@
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_INCLUDES ${LIBXML2_INCLUDE_DIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBXML2_LIBRARIES})
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS ${LIBXML2_DEFINITIONS})
check_symbol_exists(xmlReadMemory libxml/xmlreader.h HAVE_LIBXML2)
cmake_pop_check_state()
if(LLVM_ENABLE_LIBXML2 STREQUAL FORCE_ON AND NOT HAVE_LIBXML2)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106740.361415.patch
Type: text/x-patch
Size: 581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210724/0daceb02/attachment.bin>
More information about the llvm-commits
mailing list