#option(WITH_ZLIB "Build HDF5 with ZLIB" YES)
#option(WITH_SZIP "Build HDF5 with SZIP" YES)

#set(CMAKE_POLICY_DEFAULT_CMP0048 NEW)
#set(CMAKE_POLICY_DEFAULT_CMP0054 OLD)

set(HDF5_EXTERNALLY_CONFIGURED YES)
set(HDF5_DISABLE_COMPILER_WARNINGS YES)

set(HDF5_INSTALL_BIN_DIR bin)
set(HDF5_INSTALL_LIB_DIR lib)
set(HDF5_INSTALL_INCLUDE_DIR include/hdf5)
set(HDF5_INSTALL_DATA_DIR include/hdf5)
set(HDF5_INSTALL_CMAKE_DIR ${PACKAGE_CONFIG_DIR})

if (NOT CMAKE_BUILD_TYPE MATCHES RELEASE)
    set(HDF5_INSTALL_NO_DEVELOPMENT YES)
endif()
set(HDF5_BUILD_CPP_LIB YES)
set(HDF5_BUILD_FORTRAN NO)
set(HDF5_BUILD_TOOLS NO)
set(HDF5_BUILD_HL_LIB YES)
set(HDF5_ENABLE_PARALLEL NO)
set(HDF5_NO_PACKAGES YES)
# Sets the export set name
set(HDF5_EXPORTED_TARGETS hdf5-config)

if (WITH_SZIP)
    find_package(SZIP ${SZIP_VERSION} CONFIG REQUIRED)
    set(SZIP_USE_EXTERNAL YES)
    set(HDF5_ENABLE_SZIP_SUPPORT YES)
    set(HDF5_ENABLE_SZIP_ENCODING YES)
    set(SZIP_PACKAGE_NAME "szip")
endif()
if (WITH_ZLIB)
    find_package(ZLIB ${ZLIB_VERSION} REQUIRED)
    set(ZLIB_USE_EXTERNAL YES)
    set(HDF5_ENABLE_Z_LIB_SUPPORT YES)
    set(ZLIB_PACKAGE_NAME "zlib")
endif()

if (BUILD_TESTS)
    set(BUILD_TESTING ON)
else()
    set(BUILD_TESTING OFF)
endif()

include(CheckStructHasMember)
CHECK_STRUCT_HAS_MEMBER("struct tm" tm_gmtoff time.h H5_HAVE_TM_GMTOFF)
CHECK_STRUCT_HAS_MEMBER("struct tm" __tm_gmtoff time.h H5_HAVE___TM_GMTOFF)

