From 8d7d5ac9e5da41b5e6f92bc5c1178609d56e669f Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Mon, 11 May 2020 11:11:24 -0600 Subject: [PATCH] Different method of setting Parallel Filters variables The current method of setting the `HDF5_HAS_PAR_FILTERS` and `HAS_PAR_FILTERS` variables is done purely based on the `HDF5_VERSION` and that variable is only set inside the if block which finds the HDF5 library based on CMake package files. If the user specifies the explicit location of the HDF5 library and include files (for example, via: ``` -DHDF5_C_LIBRARY:PATH=${INSTALL_PATH}/lib/libhdf5.${LD_EXT} \ -DHDF5_HL_LIBRARY:PATH=${INSTALL_PATH}/lib/libhdf5_hl.${LD_EXT} \ -DHDF5_INCLUDE_DIR:PATH=${INSTALL_PATH}/include ``` Then, the code path which determines whether the par filters variables is set is not run. However, later on in the file, there is another check for parallel filter support (near line 759): ``` # Check to see if this is hdf5-1.10.3 or later. CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Dread_chunk "" HDF5_SUPPORTS_PAR_FILTERS) ``` This PR moves the code that sets the two other par filters variables down after this check and instead of setting their values based on the version, it bases it on the results of this test. I'm not totally sure why there are three variables; it looks like the `HDF5_SUPPORTS_PAR_FILTERS` and `HDF5_HAS_PAR_FILTERS` could be combined. I think the `HAS_PAR_FILTERS` is a string which is used to show the results of the configuration and the other two are booleans. The new check should work for both types of HDF5 installs (cmake-based and configure-based) --- CMakeLists.txt | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f99d5984e..afd39285b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -631,7 +631,6 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4) # Assert HDF5 version meets minimum required version. ## SET(HDF5_VERSION_REQUIRED 1.8.10) - SET(HDF5_PAR_FILTER_VERSION 1.10.3) IF(HDF5_VERSION_STRING AND NOT HDF5_VERSION) SET(HDF5_VERSION ${HDF5_VERSION_STRING}) @@ -648,15 +647,6 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4) ENDIF() ENDIF() - # Determine whether parallel filter operation is supported. - IF(${HDF5_VERSION} VERSION_LESS ${HDF5_PAR_FILTER_VERSION}) - SET(HDF5_HAS_PAR_FILTERS FALSE CACHE BOOL "") - SET(HAS_PAR_FILTERS no CACHE STRING "") - ELSE() - SET(HDF5_HAS_PAR_FILTERS TRUE CACHE BOOL "") - SET(HAS_PAR_FILTERS yes CACHE STRING "") - ENDIF() - ## # Include the HDF5 include directory. ## @@ -756,6 +746,13 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4) # Check to see if this is hdf5-1.10.3 or later. CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5Dread_chunk "" HDF5_SUPPORTS_PAR_FILTERS) + IF (HDF5_SUPPORTS_PAR_FILTERS) + SET(HDF5_HAS_PAR_FILTERS TRUE CACHE BOOL "") + SET(HAS_PAR_FILTERS yes CACHE STRING "") + ELSE() + SET(HDF5_HAS_PAR_FILTERS FALSE CACHE BOOL "") + SET(HAS_PAR_FILTERS no CACHE STRING "") + ENDIF() SET(H5_USE_16_API 1) OPTION(NC_ENABLE_HDF_16_API "Enable HDF5 1.6.x Compatibility(Required)" ON)