Refactored the HDF5 version detection logic in CMakeLists.txt in support of
@@ -831,11 +831,20 @@ IF(USE_HDF5)
# Check to see if HDF5 library is 1.10.6 or greater.
# Used to control path name conversion
- IF(${HDF5_VERSION} VERSION_LESS "1.10.6")
- SET(HDF5_UTF8_PATHS FALSE)
- ELSE()
- SET(HDF5_UTF8_PATHS TRUE)
+ # Check HDF5 version
+ SET(HDF5_UT8_PATHS OFF)
+ CHECK_C_SOURCE_COMPILES("
+ #include <H5public.h>
+ int main() {
+#if (H5_VERS_MAJOR*10000 + H5_VERS_MINOR*100 + H5_VERS_RELEASE < 11006)
+ choke me;
+#endif
+ }" HDF5_VERSION_1106)
+
+ IF(HDF5_VERSION_1106)
+ SET(HDF5_UTF8_PATHS ON)
ENDIF()
+
MESSAGE("-- Checking for HDF5 version 1.10.6 or later: ${HDF5_UTF8_PATHS}")
SET(H5_USE_16_API 1)
@@ -869,18 +878,6 @@ IF(USE_HDF5)
#option to include HDF5 High Level header file (hdf5_hl.h) in case we are not doing a make install
INCLUDE_DIRECTORIES(${HDF5_HL_INCLUDE_DIR})
- # Check HDF5 version
- CHECK_C_SOURCE_COMPILES("
- #include <H5public.h>
- int main() {
-#if (H5_VERS_MAJOR*10000 + H5_VERS_MINOR*100 + H5_VERS_RELEASE < 11006)
- choke me;
-#endif
- }" HDF5_VERSION_1106)
-
- IF(HDF5_VERSION_1106)
- SET(HDF5_UTF8_PATHS ON)
- ENDIF()
ENDIF(USE_HDF5)
