diff --git a/config/cmake/HDF5PluginMacros.cmake b/config/cmake/HDF5PluginMacros.cmake index 3ef5b90527e..b361917bcf2 100644 --- a/config/cmake/HDF5PluginMacros.cmake +++ b/config/cmake/HDF5PluginMacros.cmake @@ -24,15 +24,9 @@ macro (EXTERNAL_PLUGIN_LIBRARY compress_type) URL_HASH "" ) endif () - FetchContent_GetProperties(PLUGIN) - message (VERBOSE "HDF5_INCLUDE_DIR=${HDF5_INCLUDE_DIR}") - if(NOT PLUGIN_POPULATED) - FetchContent_Populate(PLUGIN) - include (${HDF_RESOURCES_DIR}/HDF5PluginCache.cmake) - set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) - add_subdirectory(${plugin_SOURCE_DIR} ${plugin_BINARY_DIR}) - endif () - message (VERBOSE "HDF5_INCLUDE_DIR=${HDF5_INCLUDE_DIR}") + include (${HDF_RESOURCES_DIR}/HDF5PluginCache.cmake) + set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) + FetchContent_MakeAvailable(PLUGIN) set (PLUGIN_BINARY_DIR "${plugin_BINARY_DIR}") set (PLUGIN_SOURCE_DIR "${plugin_SOURCE_DIR}") set (PLUGIN_LIBRARY "PLUGIN") diff --git a/config/cmake/HDFLibMacros.cmake b/config/cmake/HDFLibMacros.cmake index 98f8a2ba028..09f40680b72 100644 --- a/config/cmake/HDFLibMacros.cmake +++ b/config/cmake/HDFLibMacros.cmake @@ -11,31 +11,31 @@ # #------------------------------------------------------------------------------- macro (EXTERNAL_ZLIB_LIBRARY compress_type) + if (HDF5_USE_ZLIB_NG) + set (zlib_folder "ZLIBNG") + else () + set (zlib_folder "ZLIB") + endif () if (${compress_type} MATCHES "GIT") FetchContent_Declare (HDF5_ZLIB GIT_REPOSITORY ${ZLIB_URL} GIT_TAG ${ZLIB_BRANCH} + PATCH_COMMAND ${CMAKE_COMMAND} -E copy + ${HDF_RESOURCES_DIR}/${zlib_folder}/CMakeLists.txt + /CMakeLists.txt ) elseif (${compress_type} MATCHES "TGZ") message (VERBOSE "Filter ZLIB file ${ZLIB_URL}") FetchContent_Declare (HDF5_ZLIB URL ${ZLIB_URL} URL_HASH "" + PATCH_COMMAND ${CMAKE_COMMAND} -E copy + ${HDF_RESOURCES_DIR}/${zlib_folder}/CMakeLists.txt + /CMakeLists.txt ) endif () - FetchContent_GetProperties(HDF5_ZLIB) - if(NOT hdf5_zlib_POPULATED) - FetchContent_Populate(HDF5_ZLIB) - - # Copy an additional/replacement files into the populated source - if (HDF5_USE_ZLIB_NG) - file(COPY ${HDF_RESOURCES_DIR}/ZLIBNG/CMakeLists.txt DESTINATION ${hdf5_zlib_SOURCE_DIR}) - else () - file(COPY ${HDF_RESOURCES_DIR}/ZLIB/CMakeLists.txt DESTINATION ${hdf5_zlib_SOURCE_DIR}) - endif () - add_subdirectory(${hdf5_zlib_SOURCE_DIR} ${hdf5_zlib_BINARY_DIR}) - endif() + FetchContent_MakeAvailable(HDF5_ZLIB) add_library(${HDF_PACKAGE_NAMESPACE}zlib-static ALIAS zlib-static) set (H5_ZLIB_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}zlib-static") @@ -54,23 +54,21 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) FetchContent_Declare (SZIP GIT_REPOSITORY ${SZIP_URL} GIT_TAG ${SZIP_BRANCH} + PATCH_COMMAND ${CMAKE_COMMAND} -E copy + ${HDF_RESOURCES_DIR}/LIBAEC/CMakeLists.txt + /CMakeLists.txt ) elseif (${compress_type} MATCHES "TGZ") message (VERBOSE "Filter SZIP file ${SZIP_URL}") FetchContent_Declare (SZIP URL ${SZIP_URL} URL_HASH "" + PATCH_COMMAND ${CMAKE_COMMAND} -E copy + ${HDF_RESOURCES_DIR}/LIBAEC/CMakeLists.txt + /CMakeLists.txt ) endif () - FetchContent_GetProperties(SZIP) - if(NOT szip_POPULATED) - FetchContent_Populate(SZIP) - - # Copy an additional/replacement files into the populated source - file(COPY ${HDF_RESOURCES_DIR}/LIBAEC/CMakeLists.txt DESTINATION ${szip_SOURCE_DIR}) - - add_subdirectory(${szip_SOURCE_DIR} ${szip_BINARY_DIR}) - endif() + FetchContent_MakeAvailable(SZIP) add_library (${HDF_PACKAGE_NAMESPACE}szaec-static ALIAS szaec-static) add_library (${HDF_PACKAGE_NAMESPACE}aec-static ALIAS aec-static) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 29bd8a48f4b..8e908691224 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1746,6 +1746,13 @@ Bug Fixes since HDF5-1.14.0 release Configuration ------------- + - Corrected usage of FetchContent in the HDFLibMacros.cmake file. + + CMake version 3.30 changed the behavior of the FetchContent module to deprecate + the use of FetchContent_Populate() in favor of FetchContent_MakeAvailable(). Therefore, + the copying of HDF specialized CMakeLists.txt files to the dependent project's source + was implemented in the FetchContent_Declare() call. + - Fixed/reverted an Autotools configure hack that causes problems on MacOS A sed line in configure.ac was added in the past to paper over some