Skip to content

Commit 2869d51

Browse files
committed
Fix Zlib build bad URL, Use FETCHCONTENT_TRY_FIND_PACKAGE_MOD by used
1 parent 92b8384 commit 2869d51

8 files changed

Lines changed: 95 additions & 171 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ if(h5fortran_ENABLE_RPATH AND NOT WIN32)
3535
endif()
3636

3737
include(cmake/compilers.cmake)
38-
include(cmake/CheckHDF5.cmake)
3938

4039
set(CMAKE_Fortran_MODULE_DIRECTORY ${h5fortran_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR})
4140
# HDF5 fetchcontent needs this at least for HDF5 2.0.0, 2.1.0, ...
@@ -45,7 +44,7 @@ include(cmake/hdf5.cmake)
4544

4645
set(HDF5_VERSION ${HDF5_VERSION} CACHE STRING "HDF5 version")
4746

48-
if(h5fortran_IS_TOP_LEVEL AND (hdf5_parallel OR HDF5_HAVE_PARALLEL))
47+
if(h5fortran_IS_TOP_LEVEL AND (hdf5_parallel OR HDF5_IS_PARALLEL))
4948
target_link_libraries(HDF5::HDF5 INTERFACE MPI::MPI_Fortran)
5049
endif()
5150

CMakePresets.json

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
"cacheVariables": {
99
"h5fortran_warning_as_error": true,
1010
"h5fortran_BUILD_TESTING": true,
11-
"h5fortran_find": true,
1211
"h5fortran_python": true,
1312
"CMAKE_BUILD_TYPE": "Release"
1413
}
1514
},
1615
{ "name": "build", "inherits": "default",
16+
"displayName": "Build HDF5 and ZLib from source with h5fortran",
1717
"cacheVariables": {
1818
"h5fortran_BUILD_TESTING": false,
19-
"h5fortran_find": false
19+
"FETCHCONTENT_TRY_FIND_PACKAGE_MODE": "NEVER"
2020
}
2121
},
2222
{ "name": "debug", "inherits": "default",
@@ -28,7 +28,7 @@
2828
{
2929
"name": "reldebug", "inherits": "default",
3030
"binaryDir": "build",
31-
"displayName": "release with debug info",
31+
"displayName": "Release with Debug Info",
3232
"cacheVariables": {
3333
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
3434
}
@@ -39,15 +39,7 @@
3939
"cacheVariables": {
4040
"BUILD_SHARED_LIBS": true,
4141
"h5fortran_ENABLE_RPATH": true,
42-
"h5fortran_find": false
43-
}
44-
},
45-
{
46-
"name": "nofind", "inherits": "reldebug",
47-
"binaryDir": "build-nofind",
48-
"displayName": "don't find HDF5 or Zlib",
49-
"cacheVariables": {
50-
"h5fortran_find": false
42+
"FETCHCONTENT_TRY_FIND_PACKAGE_MODE": "NEVER"
5143
}
5244
},
5345
{
@@ -64,7 +56,6 @@
6456
"buildPresets": [
6557
{ "name": "default", "configurePreset": "default", "jobs": 0 },
6658
{ "name": "build", "configurePreset": "build", "inherits": "default" },
67-
{ "name": "nofind", "configurePreset": "nofind", "inherits": "default" },
6859
{ "name": "shared", "configurePreset": "shared", "inherits": "default" },
6960
{
7061
"name": "explain",
@@ -81,7 +72,6 @@
8172
"configurePreset": "default",
8273
"nativeToolOptions": ["-d", "stats"]
8374
},
84-
{ "name": "release","configurePreset": "default" },
8575
{
8676
"name": "reldebug",
8777
"configurePreset": "reldebug",
@@ -111,9 +101,7 @@
111101
"timeout": 60
112102
}
113103
},
114-
{ "name": "nofind", "configurePreset": "nofind", "inherits": "default" },
115104
{ "name": "shared", "configurePreset": "shared", "inherits": "default" },
116-
{ "name": "release", "inherits": "default" },
117105
{
118106
"name": "reldebug", "inherits": "default",
119107
"configurePreset": "reldebug",
@@ -124,6 +112,7 @@
124112
"workflowPresets": [
125113
{
126114
"name": "default",
115+
"displayName": "Build and Test in Release mode",
127116
"steps": [
128117
{ "type": "configure", "name": "default" },
129118
{ "type": "build", "name": "default" },
@@ -132,13 +121,15 @@
132121
},
133122
{
134123
"name": "build",
124+
"displayName": "Build HDF5 and ZLib from source with h5fortran",
135125
"steps": [
136126
{ "type": "configure", "name": "build" },
137127
{ "type": "build", "name": "build" }
138128
]
139129
},
140130
{
141131
"name": "debug",
132+
"displayName": "Build and Test in Debug mode",
142133
"steps": [
143134
{ "type": "configure", "name": "debug" },
144135
{ "type": "build", "name": "debug" },
@@ -147,35 +138,21 @@
147138
},
148139
{
149140
"name": "reldebug",
141+
"displayName": "Build and Test in Release with Debug Info mode",
150142
"steps": [
151143
{ "type": "configure", "name": "reldebug" },
152144
{ "type": "build", "name": "reldebug" },
153145
{ "type": "test", "name": "reldebug" }
154146
]
155147
},
156-
{
157-
"name": "release",
158-
"steps": [
159-
{ "type": "configure", "name": "default" },
160-
{ "type": "build", "name": "release" },
161-
{ "type": "test", "name": "release" }
162-
]
163-
},
164148
{
165149
"name": "shared",
150+
"displayName": "Build and Test shared libraries",
166151
"steps": [
167152
{ "type": "configure", "name": "shared" },
168153
{ "type": "build", "name": "shared" },
169154
{ "type": "test", "name": "shared" }
170155
]
171-
},
172-
{
173-
"name": "nofind",
174-
"steps": [
175-
{ "type": "configure", "name": "nofind" },
176-
{ "type": "build", "name": "nofind" },
177-
{ "type": "test", "name": "nofind" }
178-
]
179156
}
180157
]
181158
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ cmake --workflow build
112112
Optionally, set the version of HDF5 to build with h5fortran_hdf5_req (see cmake/libraries.json), for example:
113113

114114
```sh
115-
cmake -B build -Dh5fortran_find=false -Dh5fortran_hdf5_req=2.1
115+
cmake -B build -DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=NEVER -Dh5fortran_hdf5_req=2.1
116116
```
117117

118118
see [cmake/libraries.json](./cmake/libraries.json) for supported HDF5 versions.

cmake/CheckHDF5.cmake

Lines changed: 0 additions & 107 deletions
This file was deleted.

cmake/FindHDF5.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Result Variables
2929
``HDF5_<lang>_COMPILER_EXECUTABLE``
3030
wrapper compiler for HDF5
3131
32-
``HDF5_HAVE_PARALLEL``
32+
``HDF5_IS_PARALLEL``
3333
HDF5 links the MPI library (thus user program must link MPI as well)
3434
3535
Components
@@ -130,11 +130,11 @@ check_symbol_exists(H5_HAVE_FILTER_SZIP ${h5_conf} hdf5_have_szip)
130130
check_symbol_exists(H5_HAVE_FILTER_DEFLATE ${h5_conf} hdf5_have_zlib)
131131

132132
# Always check for HDF5 MPI support because HDF5 link fails if MPI is linked into HDF5.
133-
check_symbol_exists(H5_HAVE_PARALLEL ${h5_conf} HDF5_HAVE_PARALLEL)
133+
check_symbol_exists(H5_HAVE_PARALLEL ${h5_conf} HDF5_IS_PARALLEL)
134134

135135
set(HDF5_parallel_FOUND false)
136136

137-
if(HDF5_HAVE_PARALLEL)
137+
if(HDF5_IS_PARALLEL)
138138
find_mpi()
139139
if(NOT MPI_FOUND)
140140
return()

0 commit comments

Comments
 (0)