Configuring 1.8.18 on macOS Sierra with GFortran 6.3.0

I am having issues configuring HDF5 1.8.18 with CMake on macOS Sierra using GFortran 6.3.0 and the normal Xcode tooling. The following is the error that I get during cmake configuration:

-- Detecting Fortran/C Interface
-- Detecting Fortran/C Interface - Failed to compile
CMake Error at config/cmake_ext_mod/HDFUseFortran.cmake:18 (string):
   string sub-command REGEX, mode MATCH needs at least 5 arguments total to
   command.
Call Stack (most recent call first):
   CMakeLists.txt:754 (include)

CMake Error at config/cmake_ext_mod/HDFUseFortran.cmake:22 (string):
   string sub-command REGEX, mode MATCH needs at least 5 arguments total to
   command.
Call Stack (most recent call first):
   CMakeLists.txt:754 (include)

Here is the CMake invocation from the command line:

HDF5_VERSION=1.8.18
HDF5_FOLDER_NAME=hdf5-1.8.18
HDF5_ARCHIVE_NAME=hdf5-1.8.18.tar.gz
HDF5_INSTALL=hdf5-1.8.18
cd ${HDF5_FOLDER_NAME}
mkdir Debug
cd Debug
cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug -DHDF5_BUILD_TOOLS=ON -DHDF5_BUILD_FORTRAN=ON -DHDF5_BUILD_WITH_INSTALL_NAME=ON -DHDF5_BUILD_CPP_LIB=ON -DHDF5_BUILD_HL_LIB=ON -DCMAKE_INSTALL_PREFIX=$SDK_INSTALL/hdf5-${HDF5_VERSION}-Debug ../
make -j${PARALLEL_BUILD}
make install

has anyone else had this problem?

I found the problem in HDFUseFortran.cmake:

file (STRINGS ${CMAKE_BINARY_DIR}/FCMangle.h CONTENTS REGEX "H5_FC_GLOBAL\\(.*,.*\\) +(.*)")
string (REGEX MATCH "H5_FC_GLOBAL\\(.*,.*\\) +(.*)" RESULT "${CONTENTS}")
set (H5_FC_FUNC "H5_FC_FUNC(name,NAME) ${CMAKE_MATCH_1}")

file (STRINGS ${CMAKE_BINARY_DIR}/FCMangle.h CONTENTS REGEX "H5_FC_GLOBAL_\\(.*,.*\\) +(.*)")
string (REGEX MATCH "H5_FC_GLOBAL_\\(.*,.*\\) +(.*)" RESULT "${CONTENTS}")
set (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) ${CMAKE_MATCH_1}")

Thanks

···

--
Michael A. Jackson
BlueQuartz Software, LLC
[e]: mike.jackson@bluequartz.net

Check argument for CMake REGEX FCMangle.h. by hyoklee · Pull Request #4029 · HDFGroup/hdf5 (github.com)