diff --git a/CMakeVOL.cmake b/CMakeVOL.cmake index 9822ece214c..d026a6affce 100644 --- a/CMakeVOL.cmake +++ b/CMakeVOL.cmake @@ -27,11 +27,11 @@ function (get_generated_cmake_targets out_var dir) endfunction () # For now, only support building of external VOL connectors with FetchContent -option (HDF5_VOL_ALLOW_EXTERNAL "Allow building of external HDF5 VOL connectors with FetchContent" OFF) +option (HDF5_VOL_ALLOW_EXTERNAL "Allow building of external HDF5 VOL connectors with FetchContent" "NO") mark_as_advanced (HDF5_VOL_ALLOW_EXTERNAL) if (HDF5_VOL_ALLOW_EXTERNAL) - if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "NO" OR (NOT HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" AND NOT HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "LOCAL_DIR")) - message (FATAL_ERROR "HDF5_ALLOW_EXTERNAL_SUPPORT must be set to 'GIT' or 'LOCAL_DIR' to allow building of external HDF5 VOL connectors") + if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "NO" OR (NOT HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT" AND NOT HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR")) + message (FATAL_ERROR "HDF5_VOL_ALLOW_EXTERNAL must be set to 'GIT' or 'LOCAL_DIR' to allow building of external HDF5 VOL connectors") endif() # For compatibility, set some variables that projects would @@ -60,11 +60,11 @@ if (HDF5_VOL_ALLOW_EXTERNAL) math (EXPR vol_idx_len "${vol_idx_len}+1") endwhile () - if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT") + if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT") set (HDF5_VOL_URL${vol_idx_fixed} "" CACHE STRING "Git repository URL of an external HDF5 VOL connector to build") mark_as_advanced (HDF5_VOL_URL${vol_idx_fixed}) set (HDF5_VOL_SOURCE "${HDF5_VOL_URL${vol_idx_fixed}}") - elseif(HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "LOCAL_DIR") + elseif(HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR") set (HDF5_VOL_PATH${vol_idx_fixed} "" CACHE STRING "Path to the source directory of an external HDF5 VOL connector to build") mark_as_advanced (HDF5_VOL_PATH${vol_idx_fixed}) set (HDF5_VOL_SOURCE "${HDF5_VOL_PATH${vol_idx_fixed}}") @@ -72,7 +72,7 @@ if (HDF5_VOL_ALLOW_EXTERNAL) if (NOT "${HDF5_VOL_SOURCE}" STREQUAL "") # Deal with trailing slash in path for LOCAL_DIR case - if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "LOCAL_DIR") + if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR") # Erase trailing slash string (REGEX REPLACE "/$" "" HDF5_VOL_SOURCE ${HDF5_VOL_SOURCE}) endif() @@ -80,9 +80,9 @@ if (HDF5_VOL_ALLOW_EXTERNAL) # Extract the name of the VOL connector string (FIND "${HDF5_VOL_SOURCE}" "/" hdf5_vol_name_pos REVERSE) if (hdf5_vol_name_pos EQUAL -1) - if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT") + if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT") message (SEND_ERROR "Invalid URL '${HDF5_VOL_SOURCE}' specified for HDF5_VOL_URL${vol_idx_fixed}") - elseif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "LOCAL_DIR") + elseif (HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR") message (SEND_ERROR "Invalid source path '${HDF5_VOL_SOURCE}' specified for HDF5_VOL_PATH${vol_idx_fixed}") else() endif() @@ -99,7 +99,7 @@ if (HDF5_VOL_ALLOW_EXTERNAL) message (VERBOSE "Building VOL connector '${hdf5_vol_name}' with FetchContent from source ${HDF5_VOL_SOURCE}") # Set some cache variables that can be set by users when building - if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT") + if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT") set ("HDF5_VOL_${hdf5_vol_name_upper}_BRANCH" "main" CACHE STRING "Git branch (or tag) to use when building VOL connector '${hdf5_vol_name}'") mark_as_advanced ("HDF5_VOL_${hdf5_vol_name_upper}_BRANCH") endif() @@ -116,21 +116,21 @@ if (HDF5_VOL_ALLOW_EXTERNAL) endif () endif () - if ((HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT") AND ("${HDF5_VOL_${hdf5_vol_name_upper}_BRANCH}" STREQUAL "")) + if ((HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT") AND ("${HDF5_VOL_${hdf5_vol_name_upper}_BRANCH}" STREQUAL "")) message (SEND_ERROR "HDF5_VOL_${hdf5_vol_name_upper}_BRANCH must be set to a valid git branch name (or git tag) to build VOL connector '${hdf5_vol_name}'") endif () - if ((HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "LOCAL_DIR") + if ((HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR") AND NOT (EXISTS ${HDF5_VOL_SOURCE} AND IS_DIRECTORY ${HDF5_VOL_SOURCE})) message (FATAL_ERROR "HDF5_VOL_PATH${vol_idx_fixed} must be an absolute path to a valid directory") endif () - if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT") + if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT") FetchContent_Declare (HDF5_VOL_${hdf5_vol_name_lower} GIT_REPOSITORY "${HDF5_VOL_SOURCE}" GIT_TAG "${HDF5_VOL_${hdf5_vol_name_upper}_BRANCH}" ) - elseif(HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "LOCAL_DIR") + elseif(HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR") FetchContent_Declare (HDF5_VOL_${hdf5_vol_name_lower} SOURCE_DIR "${HDF5_VOL_SOURCE}" ) @@ -141,9 +141,9 @@ if (HDF5_VOL_ALLOW_EXTERNAL) FetchContent_Populate(HDF5_VOL_${hdf5_vol_name_lower}) if (NOT EXISTS "${hdf5_vol_${hdf5_vol_name_lower}_SOURCE_DIR}/CMakeLists.txt") - if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT") + if (HDF5_VOL_ALLOW_EXTERNAL MATCHES "GIT") message (SEND_ERROR "The git repository branch '${HDF5_VOL_${hdf5_vol_name_upper}_BRANCH}' for VOL connector '${hdf5_vol_name}' does not appear to contain a CMakeLists.txt file") - elseif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "LOCAL_DIR") + elseif (HDF5_VOL_ALLOW_EXTERNAL MATCHES "LOCAL_DIR") message(SEND_ERROR "The local directory '${HDF5_VOL_SOURCE}' for VOL connector '${hdf5_vol_name}' does not appear to contain a CMakeLists.txt file") endif() endif () diff --git a/doc/cmake-vols-fetchcontent.md b/doc/cmake-vols-fetchcontent.md index db9eabd9e69..9d3c1ba85ac 100644 --- a/doc/cmake-vols-fetchcontent.md +++ b/doc/cmake-vols-fetchcontent.md @@ -18,22 +18,18 @@ are the following: ## Building To enable building of an HDF5 VOL connector using HDF5's CMake functionality, -two CMake variables must first be set: +a CMake variable must first be set: - HDF5_VOL_ALLOW_EXTERNAL (Default: OFF) - This variable determines whether or not building of external HDF5 VOL connectors - is enabled. - - HDF5_ALLOW_EXTERNAL_SUPPORT (Default: "NO") + HDF5_VOL_ALLOW_EXTERNAL (Default: "NO") This variable is a string that specifies the manner in which the source code for an external VOL connector will be retrieved. This variable must be set to "GIT" for building external VOL connectors from a Github repository, or set to "LOCAL_DIR" to build from a local source directory. + ### Building -If the `HDF5_VOL_ALLOW_EXTERNAL` option is set to ON and the `HDF5_ALLOW_EXTERNAL_SUPPORT` -variable is set to "GIT", the CMake cache will be populated with a predefined +If the `HDF5_VOL_ALLOW_EXTERNAL` option is set to "GIT", the CMake cache will be populated with a predefined (currently 10) amount of new variables, named: HDF5_VOL_URL01 @@ -54,7 +50,7 @@ functionality to retrieve the source code for a VOL connector pointed to by that URL and will try to build that VOL connector as part of the HDF5 library build process. -If `HDF5_ALLOW_EXTERNAL_SUPPORT` is set to "LOCAL_DIR", then the CMake cache +If `HDF5_VOL_ALLOW_EXTERNAL` is instead set to "LOCAL_DIR", then the CMake cache will instead be populated with the variables: HDF5_VOL_PATH01 @@ -141,8 +137,7 @@ would typically be passed when building HDF5, such as `CMAKE_INSTALL_PREFIX`, -DHDF5_ENABLE_PARALLEL=ON -DALLOW_UNSUPPORTED=ON -DHDF5_TEST_API=ON - -DHDF5_VOL_ALLOW_EXTERNAL=ON - -DHDF5_ALLOW_EXTERNAL_SUPPORT="GIT" + -DHDF5_VOL_ALLOW_EXTERNAL="GIT" -DHDF5_VOL_URL01=https://github.com/hpc-io/vol-async.git -DHDF5_VOL_VOL-ASYNC_BRANCH=develop -DHDF5_VOL_VOL-ASYNC_NAME="async under_vol=0\;under_info={}"