Skip to content

Commit

Permalink
CONNECT: don't mix bundled zlib and system libxml2
Browse files Browse the repository at this point in the history
System libxml2 uses system zlib, it might conflicts with the bundled.

In particular, on centos5 old system zlib conflicts with the newer
(after c542717) bundled zlib which causes CONNECT to crash
on xml tests.
  • Loading branch information
vuvova committed Oct 28, 2018
1 parent 3e2394a commit 411a254
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions storage/connect/CMakeLists.txt
Expand Up @@ -126,6 +126,7 @@ IF(CONNECT_WITH_LIBXML2)
FIND_PACKAGE(LibXml2)
IF (LIBXML2_FOUND)
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
SET(ZLIB_LIBRARY "") # see ZLIB_INCLUDE_DIR below
SET(XML_LIBRARY ${LIBXML2_LIBRARIES})
SET(CONNECT_SOURCES ${CONNECT_SOURCES} libdoc.cpp libdoc.h)
add_definitions(-DLIBXML2_SUPPORT)
Expand Down Expand Up @@ -343,6 +344,14 @@ IF(NOT TARGET connect)
RETURN()
ENDIF()

# Don't link with bundled zlib and systel libxml2 at the same time.
# System libxml2 uses system zlib, might conflict with the bundled one.
IF (XML_LIBRARY AND BUILD_BUNDLED_ZLIB)
GET_PROPERTY(INCS TARGET connect PROPERTY INCLUDE_DIRECTORIES)
LIST(REMOVE_ITEM INCS ${ZLIB_INCLUDE_DIR})
SET_PROPERTY(TARGET connect PROPERTY INCLUDE_DIRECTORIES ${INCS})
ENDIF()

IF(WIN32)
IF (libmongoc-1.0_FOUND)
SET_TARGET_PROPERTIES(connect PROPERTIES LINK_FLAGS
Expand Down

0 comments on commit 411a254

Please sign in to comment.