Skip to content

Commit

Permalink
Remove GCS-detected zlib shared library linkage (#1829) (#1833)
Browse files Browse the repository at this point in the history
Remove GCS-detected variables and targets and use our own instead.
This fixes a problem with macOS linkage where GCS cmake causes us to
dynamically link zlib.

Co-authored-by: Isaiah Norton <[email protected]>
  • Loading branch information
github-actions[bot] and ihnorton authored Sep 29, 2020
1 parent 5aed679 commit ad42855
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmake/Modules/FindZlib_EP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ if (NOT ZLIB_FOUND)
endif()

if (ZLIB_FOUND AND NOT TARGET Zlib::Zlib)
message(STATUS "Found Zlib: ${ZLIB_LIBRARIES}")
message(STATUS "Found Zlib, adding imported target: ${ZLIB_LIBRARIES}")
add_library(Zlib::Zlib UNKNOWN IMPORTED)
set_target_properties(Zlib::Zlib PROPERTIES
IMPORTED_LOCATION "${ZLIB_LIBRARIES}"
Expand Down
12 changes: 12 additions & 0 deletions tiledb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,18 @@ if (TILEDB_GCS)
storage_client
)
add_definitions(-DHAVE_GCS)

# work around for GCS finding the shared version of zlib: we will see the Zlib::Zlib
# transitive linkage later, and we can use the correct version there.
unset(ZLIB_FOUND)
unset(ZLIB_LIBRARIES)
unset(ZLIB_INCLUDE_DIR)

get_target_property(_GCS_INTERFACE_LIBS storage_client INTERFACE_LINK_LIBRARIES)
if ("ZLIB::ZLIB" IN_LIST _GCS_INTERFACE_LIBS)
list(REMOVE_ITEM _GCS_INTERFACE_LIBS "ZLIB::ZLIB")
set_property(TARGET storage_client PROPERTY INTERFACE_LINK_LIBRARIES "${_GCS_INTERFACE_LIBS}")
endif()
endif()

# Libcurl
Expand Down

0 comments on commit ad42855

Please sign in to comment.