diff --git a/cmake/hdf5.cmake b/cmake/hdf5.cmake index 00c5beb..ada5f68 100644 --- a/cmake/hdf5.cmake +++ b/cmake/hdf5.cmake @@ -32,11 +32,16 @@ set(HDF5_INCLUDE_DIRS ${CMAKE_INSTALL_FULL_INCLUDEDIR}) file(READ ${CMAKE_CURRENT_LIST_DIR}/libraries.json json) # --- Zlib +if(build_zlib) + set(zlib_dep DEPENDS ZLIB) if(TARGET ZLIB::ZLIB) add_custom_target(ZLIB) else() include(${CMAKE_CURRENT_LIST_DIR}/zlib.cmake) endif() +else() + set(zlib_dep) +endif() # --- HDF5 # 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() if(hdf5_url MATCHES "hdf5_([0-9]+\.[0-9]+\.[0-9]+)\.") set(HDF5_VERSION "${CMAKE_MATCH_1}") +elseif(hdf5_url MATCHES "hdf5-([0-9]+\_[0-9]+\_[0-9]+)") + string(REPLACE "_" "." HDF5_VERSION "${CMAKE_MATCH_1}") +else() + message(FATAL_ERROR "Could not determine HDF5 version from URL: ${hdf5_url}") endif() message(STATUS "Building HDF5 version ${HDF5_VERSION}") @@ -84,7 +93,7 @@ ExternalProject_Add(HDF5 URL ${hdf5_url} CMAKE_ARGS ${hdf5_cmake_args} BUILD_BYPRODUCTS ${HDF5_LIBRARIES} -DEPENDS ZLIB +${zlib_dep} CONFIGURE_HANDLED_BY_BUILD ON USES_TERMINAL_DOWNLOAD true USES_TERMINAL_UPDATE true diff --git a/cmake/libraries.json b/cmake/libraries.json index ec33162..34f1c31 100644 --- a/cmake/libraries.json +++ b/cmake/libraries.json @@ -6,6 +6,6 @@ "url" : "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.2.2.tar.gz" }, "hdf5": { - "url": "https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5_1.14.5.tar.gz" + "url": "https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_10_11.tar.gz" } } diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index c9ab22c..392df3f 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -7,6 +7,7 @@ LANGUAGES C Fortran option(hdf5_parallel "build HDF5 parallel MPI") option(zlib_legacy "use legacy zlib 1.x") +option(build_zlib "build zlib") # --- system checks message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")