Skip to content

Commit 3d19bac

Browse files
committed
fix Zlib build bug introduced in b864867
1 parent 2a4d705 commit 3d19bac

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

cmake/hdf5.cmake

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,18 @@ file(READ ${CMAKE_CURRENT_LIST_DIR}/libraries.json json)
3838
# --- Zlib
3939
if(build_zlib)
4040
set(zlib_dep DEPENDS ZLIB)
41-
if(TARGET ZLIB::ZLIB)
42-
add_custom_target(ZLIB)
43-
else()
44-
include(${CMAKE_CURRENT_LIST_DIR}/zlib.cmake)
45-
endif()
4641
else()
4742
set(zlib_dep)
4843
endif()
4944

45+
if(TARGET ZLIB::ZLIB)
46+
add_custom_target(ZLIB)
47+
elseif(h5fortran_find)
48+
find_package(ZLIB)
49+
else()
50+
include(${CMAKE_CURRENT_LIST_DIR}/zlib.cmake)
51+
endif()
52+
5053
# --- HDF5
5154
# https://forum.hdfgroup.org/t/issues-when-using-hdf5-as-a-git-submodule-and-using-cmake-with-add-subdirectory/7189/2
5255

cmake/zlib.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
include(GNUInstallDirs)
44
include(ExternalProject)
55

6+
if(NOT DEFINED zlib_key)
7+
set(zlib_key zlib2)
8+
endif()
9+
610
if(NOT zlib_url)
711
string(JSON zlib_url GET ${json} ${zlib_key})
812
endif()

0 commit comments

Comments
 (0)