Remove unbundled libxml2 support

This commit is contained in:
Azat Khuzhin 2022-01-18 00:51:17 +03:00
parent 614f86edbb
commit f2b1f65ce1
6 changed files with 7 additions and 45 deletions

View File

@ -488,7 +488,6 @@ include (GNUInstallDirs)
include (cmake/find/cyrus-sasl.cmake)
include (cmake/find/llvm.cmake)
include (cmake/find/libxml2.cmake)
include (cmake/find/curl.cmake)
include (cmake/find/s3.cmake)
include (cmake/find/nlp.cmake)

View File

@ -1,34 +0,0 @@
option (USE_INTERNAL_LIBXML2_LIBRARY "Set to FALSE to use system libxml2 library instead of bundled" ON)
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/libxml2/libxml.h")
if (USE_INTERNAL_LIBXML2_LIBRARY)
message (WARNING "submodule contrib/libxml2 is missing. to fix try run: \n git submodule update --init")
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal libxml")
set (USE_INTERNAL_LIBXML2_LIBRARY 0)
endif ()
set (MISSING_INTERNAL_LIBXML2_LIBRARY 1)
endif ()
if (NOT USE_INTERNAL_LIBXML2_LIBRARY)
find_package (LibXml2)
#find_library (LIBXML2_LIBRARY libxml2)
#find_path (LIBXML2_INCLUDE_DIR NAMES libxml.h PATHS ${LIBXML2_INCLUDE_PATHS})
if (NOT LIBXML2_LIBRARY OR NOT LIBXML2_INCLUDE_DIR)
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system libxml2")
endif ()
if (USE_STATIC_LIBRARIES)
find_package(LibLZMA)
set (LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES})
endif ()
endif ()
if (LIBXML2_LIBRARY AND LIBXML2_INCLUDE_DIR)
elseif (NOT MISSING_INTERNAL_LIBXML2_LIBRARY)
set (LIBXML2_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/libxml2/include ${ClickHouse_SOURCE_DIR}/contrib/libxml2-cmake/linux_x86_64/include)
set (USE_INTERNAL_LIBXML2_LIBRARY 1)
set (LIBXML2_LIBRARIES libxml2)
endif ()
message (STATUS "Using libxml2: ${LIBXML2_INCLUDE_DIR} : ${LIBXML2_LIBRARIES}")

View File

@ -111,10 +111,7 @@ if (USE_EMBEDDED_COMPILER)
endif ()
add_subdirectory(libgsasl-cmake)
if (USE_INTERNAL_LIBXML2_LIBRARY)
add_subdirectory(libxml2-cmake)
endif ()
add_subdirectory(libxml2-cmake)
if (USE_INTERNAL_AWS_S3_LIBRARY)
add_subdirectory(aws-s3-cmake)

View File

@ -76,7 +76,7 @@ if (CURL_FOUND)
target_link_libraries(_azure_sdk PRIVATE ${CURL_LIBRARY})
endif()
target_link_libraries(_azure_sdk PRIVATE ${LIBXML2_LIBRARIES})
target_link_libraries(_azure_sdk PRIVATE ch_contrib::libxml2)
target_include_directories(_azure_sdk SYSTEM BEFORE PUBLIC ${AZURE_SDK_INCLUDES})

View File

@ -113,15 +113,13 @@ target_include_directories(_hdfs3 PRIVATE ${HDFS3_SOURCE_DIR})
target_include_directories(_hdfs3 PRIVATE ${HDFS3_COMMON_DIR})
target_include_directories(_hdfs3 PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(_hdfs3 PRIVATE ${LIBXML2_INCLUDE_DIR})
target_include_directories(_hdfs3 SYSTEM BEFORE INTERFACE "${ClickHouse_SOURCE_DIR}/contrib/libhdfs3/include")
target_link_libraries(_hdfs3 PRIVATE ch_contrib::gsasl)
if (WITH_KERBEROS)
target_link_libraries(_hdfs3 PRIVATE ch_contrib::krb5)
endif()
target_link_libraries(_hdfs3 PRIVATE ${LIBXML2_LIBRARIES})
target_link_libraries(_hdfs3 PRIVATE ch_contrib::libxml2)
# inherit from parent cmake
target_link_libraries(_hdfs3 PRIVATE ch_contrib::protobuf boost::headers_only)

View File

@ -57,5 +57,7 @@ if(M_LIBRARY)
target_link_libraries(libxml2 PRIVATE ${M_LIBRARY})
endif()
target_include_directories(libxml2 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/linux_x86_64/include")
target_include_directories(libxml2 PUBLIC "${LIBXML2_SOURCE_DIR}/include")
target_include_directories(libxml2 BEFORE PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/linux_x86_64/include")
target_include_directories(libxml2 BEFORE PUBLIC "${LIBXML2_SOURCE_DIR}/include")
add_library(ch_contrib::libxml2 ALIAS libxml2)