From 34cd27a6781b7b0fcb9d711e280ae05d06390617 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 12 Oct 2023 16:37:12 -0500 Subject: Correct use of set() command with options (#3667) * Correct use of set() command with options * Force filter off if not found --- CMakeFilters.cmake | 18 ++++++++++-------- CMakePlugins.cmake | 7 +++---- config/cmake/HDF5PluginMacros.cmake | 4 ++-- release_docs/INSTALL_CMake.txt | 18 +++++++++--------- 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake index ced30b6..e07f353 100644 --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake @@ -10,10 +10,9 @@ # help@hdfgroup.org. # option (USE_LIBAEC_STATIC "Use static AEC library " OFF) -option (ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" 0) -option (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 0) +option (ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" OFF) +option (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" OFF) -set (ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" 1) if (NOT ZLIB_USE_LOCALCONTENT) set (ZLIB_URL ${ZLIB_TGZ_ORIGPATH}/${ZLIB_TGZ_NAME}) else () @@ -23,7 +22,6 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") message (VERBOSE "Filter ZLIB file is ${ZLIB_URL}") endif () -set (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 1) if (NOT LIBAEC_USE_LOCALCONTENT) set (SZIP_URL ${LIBAEC_TGZ_ORIGPATH}/${LIBAEC_TGZ_NAME}) else () @@ -38,8 +36,8 @@ include (ExternalProject) set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO GIT TGZ)") set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO GIT TGZ) if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") - set (ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" 1) - set (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 1) + set (ZLIB_USE_EXTERNAL ON CACHE BOOL "Use External Library Building for ZLIB") + set (SZIP_USE_EXTERNAL ON CACHE BOOL "Use External Library Building for SZIP") if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT") set (ZLIB_URL ${ZLIB_GIT_URL} CACHE STRING "Path to zlib git repository") set (ZLIB_BRANCH ${ZLIB_GIT_BRANCH}) @@ -62,8 +60,10 @@ if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MAT endif () endif () else () - set (ZLIB_USE_EXTERNAL 0) - set (SZIP_USE_EXTERNAL 0) + set (HDF5_ENABLE_Z_LIB_SUPPORT OFF CACHE BOOL "" FORCE) + set (ZLIB_USE_EXTERNAL OFF CACHE BOOL "Use External Library Building for ZLIB") + set (HDF5_ENABLE_SZIP_SUPPORT OFF CACHE BOOL "" FORCE) + set (SZIP_USE_EXTERNAL OFF CACHE BOOL "Use External Library Building for SZIP") endif () endif () @@ -112,6 +112,7 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT) INCLUDE_DIRECTORIES (${ZLIB_INCLUDE_DIRS}) message (VERBOSE "Filter HDF5_ZLIB is ON") else () + set (HDF5_ENABLE_Z_LIB_SUPPORT OFF CACHE BOOL "" FORCE) message (WARNING " ZLib support in HDF5 was enabled but not found") endif () endif () @@ -162,6 +163,7 @@ if (HDF5_ENABLE_SZIP_SUPPORT) set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} ENCODE") endif () else () + set (HDF5_ENABLE_SZIP_SUPPORT OFF CACHE BOOL "" FORCE) message (WARNING "SZIP support in HDF5 was enabled but not found") endif () endif () diff --git a/CMakePlugins.cmake b/CMakePlugins.cmake index b96d1ee..bc1074f 100644 --- a/CMakePlugins.cmake +++ b/CMakePlugins.cmake @@ -9,9 +9,8 @@ # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # -option (PLUGIN_USE_EXTERNAL "Use External Library Building for filter PLUGIN" 0) +option (PLUGIN_USE_EXTERNAL "Use External Library Building for filter PLUGIN" OFF) -set (PLUGIN_USE_EXTERNAL "Use External Library Building for PLUGIN" 1) if (NOT PLUGIN_USE_LOCALCONTENT) set (PLUGIN_URL ${PLUGIN_TGZ_ORIGPATH}/${PLUGIN_TGZ_NAME}) else () @@ -27,7 +26,7 @@ include (ExternalProject) set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO GIT TGZ)") set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO GIT TGZ) if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") - set (PLUGIN_USE_EXTERNAL "Use External Library Building for PLUGIN" 1) + set (PLUGIN_USE_EXTERNAL ON CACHE BOOL "Use External Library Building for PLUGIN") if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT") set (PLUGIN_URL ${PLUGIN_GIT_URL} CACHE STRING "Path to PLUGIN git repository") set (PLUGIN_BRANCH ${PLUGIN_GIT_BRANCH}) @@ -42,7 +41,7 @@ if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MAT endif () endif () else () - set (PLUGIN_USE_EXTERNAL 0) + set (PLUGIN_USE_EXTERNAL OFF CACHE BOOL "Use External Library Building for PLUGIN") message (VERBOSE "Filter PLUGIN not built") endif () endif () diff --git a/config/cmake/HDF5PluginMacros.cmake b/config/cmake/HDF5PluginMacros.cmake index aa409f7..41f746f 100644 --- a/config/cmake/HDF5PluginMacros.cmake +++ b/config/cmake/HDF5PluginMacros.cmake @@ -94,10 +94,10 @@ macro (FILTER_OPTION plname) string(TOLOWER ${plname} PLUGIN_NAME) option (ENABLE_${plname} "Enable Library Building for ${plname} plugin" ON) if (ENABLE_${plname}) - option (HDF_${plname}_USE_EXTERNAL "Use External Library Building for ${PLUGIN_NAME} plugin" 0) + option (HDF_${plname}_USE_EXTERNAL "Use External Library Building for ${PLUGIN_NAME} plugin" OFF) mark_as_advanced (HDF_${plname}_USE_EXTERNAL) if (H5PL_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR H5PL_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") - set (HDF_${plname}_USE_EXTERNAL 1 CACHE BOOL "Use External Library Building for ${PLUGIN_NAME} plugin" FORCE) + set (HDF_${plname}_USE_EXTERNAL ON CACHE BOOL "Use External Library Building for ${PLUGIN_NAME} plugin" FORCE) if (H5PL_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT") set (HDF_${plname}_URL ${HDF_${plname}_GIT_URL}) set (HDF_${plname}_BRANCH ${HDF_${plname}_GIT_BRANCH}) diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 8fc2dee..620ff34 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -885,19 +885,19 @@ HDF5_ENABLE_PLUGIN_SUPPORT "Enable PLUGIN Filters" HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" ON HDF5_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" ON -ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" 0 -ZLIB_TGZ_ORIGPATH "Use ZLIB from original location" "https://github.com/madler/zlib/releases/download/v1.2.13" -ZLIB_TGZ_NAME "Use ZLIB from original compressed file" "zlib-1.2.13.tar.gz" -ZLIB_USE_LOCALCONTENT "Use local file for ZLIB FetchContent" ON +ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" OFF +ZLIB_TGZ_ORIGPATH "Use ZLIB from original location" "https://github.com/madler/zlib/releases/download/v1.2.13" +ZLIB_TGZ_NAME "Use ZLIB from original compressed file" "zlib-1.2.13.tar.gz" +ZLIB_USE_LOCALCONTENT "Use local file for ZLIB FetchContent" ON -SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 0 +SZIP_USE_EXTERNAL "Use External Library Building for SZIP" OFF if (HDF5_ENABLE_SZIP_SUPPORT) - HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" ON -LIBAEC_TGZ_ORIGPATH "Use LIBAEC from original location" "https://github.com/MathisRosenhauer/libaec/releases/download/v1.0.6/libaec-1.0.6.tar.gz" -LIBAEC_TGZ_NAME "Use LIBAEC from original compressed file" "libaec-v1.0.6.tar.gz" + HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" ON +LIBAEC_TGZ_ORIGPATH "Use LIBAEC from original location" "https://github.com/MathisRosenhauer/libaec/releases/download/v1.0.6/libaec-1.0.6.tar.gz" +LIBAEC_TGZ_NAME "Use LIBAEC from original compressed file" "libaec-v1.0.6.tar.gz" LIBAEC_USE_LOCALCONTENT "Use local file for LIBAEC FetchContent" ON -PLUGIN_USE_EXTERNAL "Use External Library Building for PLUGINS" 0 +PLUGIN_USE_EXTERNAL "Use External Library Building for PLUGINS" OFF if (WINDOWS) H5_DEFAULT_PLUGINDIR "%ALLUSERSPROFILE%/hdf5/lib/plugin" else () -- cgit v0.12