Skip to content

Commit 014b43c

Browse files
committed
Merge error messages for build features
1 parent 49b7b48 commit 014b43c

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

hdf5-sys/build.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -684,20 +684,18 @@ impl Config {
684684
}
685685

686686
fn check_against_features_required(&self) {
687-
if feature_enabled("DEPRECATED") {
688-
assert!(!self.header.have_no_deprecated, "Required deprecated symbols are not present")
689-
}
690-
if feature_enabled("THREADSAFE") {
691-
assert!(
692-
self.header.have_threadsafe,
693-
"Required threadsafe but library was not build using the threadsafe option"
694-
);
695-
}
696-
if feature_enabled("ZLIB") {
697-
assert!(
698-
self.header.have_zlib,
699-
"Required zlib filter but library does not have builtin support for this options"
700-
);
687+
let h = &self.header;
688+
for (flag, feature, native) in [
689+
(h.have_no_deprecated, "deprecated", "HDF5_ENABLE_DEPRECATED_SYMBOLS"),
690+
(h.have_threadsafe, "threadsafe", "HDF5_ENABLE_THREADSAFE"),
691+
(h.have_zlib, "zlib", "HDF5_ENABLE_Z_LIB_SUPPORT"),
692+
] {
693+
if feature_enabled(&feature.to_ascii_uppercase()) {
694+
assert!(
695+
flag,
696+
"Enabled feature {feature:?} but the HDF5 library was not built with {native}"
697+
);
698+
}
701699
}
702700
}
703701
}

0 commit comments

Comments
 (0)