Skip to content

Commit 7824059

Browse files
committed
hdf5 version extract from old and new URL format
1 parent f760599 commit 7824059

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

cmake/hdf5.cmake

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,16 @@ set(HDF5_INCLUDE_DIRS ${CMAKE_INSTALL_FULL_INCLUDEDIR})
3232
file(READ ${CMAKE_CURRENT_LIST_DIR}/libraries.json json)
3333

3434
# --- Zlib
35+
if(build_zlib)
36+
set(zlib_dep DEPENDS ZLIB)
3537
if(TARGET ZLIB::ZLIB)
3638
add_custom_target(ZLIB)
3739
else()
3840
include(${CMAKE_CURRENT_LIST_DIR}/zlib.cmake)
3941
endif()
42+
else()
43+
set(zlib_dep)
44+
endif()
4045

4146
# --- HDF5
4247
# https://forum.hdfgroup.org/t/issues-when-using-hdf5-as-a-git-submodule-and-using-cmake-with-add-subdirectory/7189/2
@@ -76,6 +81,10 @@ endif()
7681

7782
if(hdf5_url MATCHES "hdf5_([0-9]+\.[0-9]+\.[0-9]+)\.")
7883
set(HDF5_VERSION "${CMAKE_MATCH_1}")
84+
elseif(hdf5_url MATCHES "hdf5-([0-9]+\_[0-9]+\_[0-9]+)")
85+
string(REPLACE "_" "." HDF5_VERSION "${CMAKE_MATCH_1}")
86+
else()
87+
message(FATAL_ERROR "Could not determine HDF5 version from URL: ${hdf5_url}")
7988
endif()
8089

8190
message(STATUS "Building HDF5 version ${HDF5_VERSION}")
@@ -84,7 +93,7 @@ ExternalProject_Add(HDF5
8493
URL ${hdf5_url}
8594
CMAKE_ARGS ${hdf5_cmake_args}
8695
BUILD_BYPRODUCTS ${HDF5_LIBRARIES}
87-
DEPENDS ZLIB
96+
${zlib_dep}
8897
CONFIGURE_HANDLED_BY_BUILD ON
8998
USES_TERMINAL_DOWNLOAD true
9099
USES_TERMINAL_UPDATE true

cmake/libraries.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
"url" : "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.2.2.tar.gz"
77
},
88
"hdf5": {
9-
"url": "https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5_1.14.5.tar.gz"
9+
"url": "https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_10_11.tar.gz"
1010
}
1111
}

scripts/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ LANGUAGES C Fortran
77

88
option(hdf5_parallel "build HDF5 parallel MPI")
99
option(zlib_legacy "use legacy zlib 1.x")
10+
option(build_zlib "build zlib")
1011

1112
# --- system checks
1213
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")

0 commit comments

Comments
 (0)