@@ -855,6 +855,25 @@ if (BUILD_LIBREALSENSE)
855855 endif ()
856856endif ()
857857
858+ if (USE_SYSTEM_ZLIB)
859+ open3d_find_package_3rdparty_library(3rdparty_zlib
860+ PACKAGE ZLIB
861+ TARGETS ZLIB::ZLIB
862+ )
863+ list (APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_zlib)
864+ endif ()
865+ if (NOT USE_SYSTEM_ZLIB)
866+ include (${Open3D_3RDPARTY_DIR} /zlib/zlib.cmake)
867+ open3d_import_3rdparty_library(3rdparty_zlib
868+ HIDDEN
869+ INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}
870+ LIB_DIR ${ZLIB_LIB_DIR}
871+ LIBRARIES ${ZLIB_LIBRARIES}
872+ DEPENDS ext_zlib
873+ )
874+ list (APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_zlib)
875+ endif ()
876+
858877# Curl
859878# - Curl should be linked before PNG, otherwise it will have undefined symbols.
860879# - openssl.cmake needs to be included before curl.cmake, for the
@@ -927,15 +946,6 @@ if(USE_SYSTEM_PNG)
927946 endif ()
928947endif ()
929948if (NOT USE_SYSTEM_PNG)
930- include (${Open3D_3RDPARTY_DIR} /zlib/zlib.cmake)
931- open3d_import_3rdparty_library(3rdparty_zlib
932- HIDDEN
933- INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}
934- LIB_DIR ${ZLIB_LIB_DIR}
935- LIBRARIES ${ZLIB_LIBRARIES}
936- DEPENDS ext_zlib
937- )
938-
939949 include (${Open3D_3RDPARTY_DIR} /libpng/libpng.cmake)
940950 open3d_import_3rdparty_library(3rdparty_png
941951 INCLUDE_DIRS ${LIBPNG_INCLUDE_DIRS}
@@ -1138,12 +1148,24 @@ open3d_import_3rdparty_library(3rdparty_poisson
11381148list (APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_poisson)
11391149
11401150# Minizip
1141- if (WITH_MINIZIP)
1142- open3d_pkg_config_3rdparty_library(3rdparty_minizip
1143- SEARCH_ARGS minizip
1151+ if (USE_SYSTEM_MINIZIP)
1152+ open3d_find_package_3rdparty_library(3rdparty_zlib
1153+ PACKAGE minizip
1154+ TARGETS MINIZIP::minizip
11441155 )
11451156 list (APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_minizip)
11461157endif ()
1158+ if (NOT USE_SYSTEM_MINIZIP)
1159+ include (${Open3D_3RDPARTY_DIR} /zlib/minizip.cmake)
1160+ open3d_import_3rdparty_library(3rdparty_minizip
1161+ HIDDEN
1162+ INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS}
1163+ LIB_DIR ${MINIZIP_LIB_DIR}
1164+ LIBRARIES ${MINIZIP_LIBRARIES}
1165+ DEPENDS ext_minizip
1166+ )
1167+ list (APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_CUSTOM Open3D::3rdparty_minizip)
1168+ endif ()
11471169
11481170# Googletest
11491171if (BUILD_UNIT_TESTS)
0 commit comments