Skip to content

Commit b864867

Browse files
committed
json: simplify url specification
1 parent 7202e9d commit b864867

File tree

5 files changed

+13
-19
lines changed

5 files changed

+13
-19
lines changed

cmake/hdf5.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
include(GNUInstallDirs)
55
include(ExternalProject)
66

7+
if(NOT DEFINED hdf5_key)
8+
set(hdf5_key hdf5-1.10)
9+
endif()
10+
711
if(hdf5_parallel)
812
find_package(MPI REQUIRED COMPONENTS C)
913
endif()
@@ -74,7 +78,7 @@ if(MPI_ROOT)
7478
endif()
7579

7680
if(NOT hdf5_url)
77-
string(JSON hdf5_url GET ${json} hdf5 url)
81+
string(JSON hdf5_url GET ${json} ${hdf5_key})
7882
endif()
7983

8084
# Get HDF5 version from underscore-separated version in URL

cmake/libraries.json

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
2-
"zlib1": {
3-
"url": "https://zlib.net/zlib-1.3.1.tar.gz"
4-
},
5-
"zlib2": {
6-
"url" : "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.2.3.tar.gz"
7-
},
8-
"hdf5": {
9-
"url": "https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_10_11.tar.gz"
10-
}
2+
"zlib1": "https://zlib.net/zlib-1.3.1.tar.gz",
3+
"zlib2": "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.2.3.tar.gz",
4+
"hdf5-1.10": "https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_10_11.tar.gz",
5+
"hdf5-1.14": "https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5_1.14.5.tar.gz"
116
}

cmake/zlib.cmake

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ include(GNUInstallDirs)
44
include(ExternalProject)
55

66
if(NOT zlib_url)
7-
if(zlib_legacy)
8-
string(JSON zlib_url GET ${json} zlib1 url)
9-
else()
10-
string(JSON zlib_url GET ${json} zlib2 url)
11-
endif()
7+
string(JSON zlib_url GET ${json} ${zlib_key})
128
endif()
139

1410
set(ZLIB_INCLUDE_DIRS ${CMAKE_INSTALL_FULL_INCLUDEDIR})
@@ -20,7 +16,7 @@ if(BUILD_SHARED_LIBS)
2016
set(ZLIB_LIBRARIES ${CMAKE_INSTALL_FULL_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}z${CMAKE_SHARED_LIBRARY_SUFFIX})
2117
endif()
2218
else()
23-
if(MSVC OR (WIN32 AND zlib_legacy))
19+
if(MSVC OR (WIN32 AND zlib_key STREQUAL "zlib1"))
2420
set(ZLIB_LIBRARIES ${CMAKE_INSTALL_FULL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}zlibstatic${CMAKE_STATIC_LIBRARY_SUFFIX})
2521
else()
2622
set(ZLIB_LIBRARIES ${CMAKE_INSTALL_FULL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}z${CMAKE_STATIC_LIBRARY_SUFFIX})

ford.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ This is necessary to workaround techniques used by HDF5 CMake files that don't p
125125
Otherwise, HDF5 build failures may result due to defaulting to icl-clang.
126126

127127
By default we use Zlib 2.x a.k.a. zlib-ng.
128-
If you have a problem with Zlib-ng on your system, try the unmaintained Zlib 1.x by:
128+
If you have a problem with Zlib-ng on your system, try Zlib 1.x by:
129129

130130
```sh
131-
cmake -B build -Dzlib_legacy=on
131+
cmake -B build -Dzlib_key=zlib1
132132
```
133133

134134
## Usage

scripts/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ LANGUAGES C Fortran
66
)
77

88
option(hdf5_parallel "build HDF5 parallel MPI")
9-
option(zlib_legacy "use legacy zlib 1.x")
109
option(build_zlib "build zlib")
1110

1211
# --- system checks

0 commit comments

Comments
 (0)