From 2058d3de138d6b11446c485fcfd0da70bfd6d038 Mon Sep 17 00:00:00 2001 From: Isaiah Norton Date: Wed, 29 Jul 2020 19:57:18 +0000 Subject: [PATCH] Hot-fix for unwanted zlib linkage By removing GCS-detected variables and targets. --- cmake/Modules/FindZlib_EP.cmake | 2 +- tiledb/CMakeLists.txt | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/FindZlib_EP.cmake b/cmake/Modules/FindZlib_EP.cmake index 8bb715fac23..0de7313b160 100644 --- a/cmake/Modules/FindZlib_EP.cmake +++ b/cmake/Modules/FindZlib_EP.cmake @@ -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}" diff --git a/tiledb/CMakeLists.txt b/tiledb/CMakeLists.txt index 330a0dcc87a..093b7f702fa 100644 --- a/tiledb/CMakeLists.txt +++ b/tiledb/CMakeLists.txt @@ -322,6 +322,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 @@ -795,4 +807,4 @@ configure_file( @ONLY ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tiledb.pc - DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig) \ No newline at end of file + DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig)