Skip to content

Commit

Permalink
Correct use of set() command with options (#3667)
Browse files Browse the repository at this point in the history
* Correct use of set() command with options

* Force filter off if not found
  • Loading branch information
byrnHDF authored Oct 12, 2023
1 parent ea3f926 commit 34cd27a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
18 changes: 10 additions & 8 deletions CMakeFilters.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
# [email protected].
#
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 ()
Expand All @@ -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 ()
Expand All @@ -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})
Expand All @@ -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 ()

Expand Down Expand Up @@ -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 ()
Expand Down Expand Up @@ -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 ()
7 changes: 3 additions & 4 deletions CMakePlugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
# If you do not have access to either file, you may request a copy from
# [email protected].
#
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 ()
Expand All @@ -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})
Expand All @@ -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 ()
Expand Down
4 changes: 2 additions & 2 deletions config/cmake/HDF5PluginMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
18 changes: 9 additions & 9 deletions release_docs/INSTALL_CMake.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down

0 comments on commit 34cd27a

Please sign in to comment.