summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWeiqun Zhang <weiqunzhang@lbl.gov>2023-02-21 03:05:05 (GMT)
committerWeiqun Zhang <weiqunzhang@lbl.gov>2023-02-21 20:29:28 (GMT)
commit18c2970a97da3644c60f3cb7c9ddfb69f4fe318c (patch)
tree697843919eb37f8e85fac8e43054bada4ba8412a
parentd3ea15e80152511946c719404466dfa199532005 (diff)
downloadCMake-18c2970a97da3644c60f3cb7c9ddfb69f4fe318c.zip
CMake-18c2970a97da3644c60f3cb7c9ddfb69f4fe318c.tar.gz
CMake-18c2970a97da3644c60f3cb7c9ddfb69f4fe318c.tar.bz2
FindHDF5: Fix detection of Parallel HDF5
To detect Parallel HDF5, the output of `h5pcc -showconfig` was compared with `Parallel HDF5: yes`. However, the Boolean flag is not always `yes` or `no`, because it was set by the value in `HDF5_ENABLE_PARALLEL` if CMake was used for the configuration. This commit instead checks to see if the value is interpreted by CMake as "true".
-rw-r--r--Modules/FindHDF5.cmake20
1 files changed, 16 insertions, 4 deletions
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index db03c54..62c492c 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -334,8 +334,15 @@ function(_HDF5_test_regular_compiler_Fortran success is_parallel)
ERROR_VARIABLE config_error
RESULT_VARIABLE config_result
)
- if(config_output MATCHES "Parallel HDF5: yes")
- set(${is_parallel} TRUE PARENT_SCOPE)
+ if(config_output MATCHES "Parallel HDF5: ([A-Za-z0-9]+)")
+ # The value may be anything used when HDF5 was configured,
+ # so see if CMake interprets it as "true".
+ set(parallelHDF5 "${CMAKE_MATCH_1}")
+ if(parallelHDF5)
+ set(${is_parallel} TRUE PARENT_SCOPE)
+ else()
+ set(${is_parallel} FALSE PARENT_SCOPE)
+ endif()
else()
set(${is_parallel} FALSE PARENT_SCOPE)
endif()
@@ -401,8 +408,13 @@ function( _HDF5_invoke_compiler language output_var return_value_var version_var
string(REPLACE "HDF5 Version: " "" version "${version}")
string(REPLACE "-patch" "." version "${version}")
endif()
- if(config_output MATCHES "Parallel HDF5: yes")
- set(is_parallel TRUE)
+ if(config_output MATCHES "Parallel HDF5: ([A-Za-z0-9]+)")
+ # The value may be anything used when HDF5 was configured,
+ # so see if CMake interprets it as "true".
+ set(parallelHDF5 "${CMAKE_MATCH_1}")
+ if(parallelHDF5)
+ set(is_parallel TRUE)
+ endif()
endif()
endif()
foreach(var output return_value version is_parallel)