Skip to content

Commit b9824ed

Browse files
committed
Merge error messages for build features
1 parent 2a381d9 commit b9824ed

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
@@ -654,20 +654,18 @@ impl Config {
654654
}
655655

656656
fn check_against_features_required(&self) {
657-
if feature_enabled("DEPRECATED") {
658-
assert!(!self.header.have_no_deprecated, "Required deprecated symbols are not present")
659-
}
660-
if feature_enabled("THREADSAFE") {
661-
assert!(
662-
self.header.have_threadsafe,
663-
"Required threadsafe but library was not build using the threadsafe option"
664-
);
665-
}
666-
if feature_enabled("ZLIB") {
667-
assert!(
668-
self.header.have_zlib,
669-
"Required zlib filter but library does not have builtin support for this options"
670-
);
657+
let h = &self.header;
658+
for (flag, feature, native) in [
659+
(h.have_no_deprecated, "deprecated", "HDF5_ENABLE_DEPRECATED_SYMBOLS"),
660+
(h.have_threadsafe, "threadsafe", "HDF5_ENABLE_THREADSAFE"),
661+
(h.have_zlib, "zlib", "HDF5_ENABLE_Z_LIB_SUPPORT"),
662+
] {
663+
if feature_enabled(&feature.to_ascii_uppercase()) {
664+
assert!(
665+
flag,
666+
"Enabled feature {feature:?} but the HDF5 library was not built with {native}"
667+
);
668+
}
671669
}
672670
}
673671
}

0 commit comments

Comments
 (0)