-
-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed usage issue with FindZLIB.cmake module (#4655)
* Add a comment on the FindZLIB.cmake module usage * Allow choice of static/shared compression libs for Find Module * Added new option to INSTALL_CMake file and changed option text
- Loading branch information
Showing
6 changed files
with
54 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,8 @@ | |
# [email protected]. | ||
# | ||
option (HDF5_USE_ZLIB_NG "Use zlib-ng library as zlib library" OFF) | ||
option (HDF5_USE_LIBAEC_STATIC "Use static AEC library" OFF) | ||
option (HDF5_USE_ZLIB_STATIC "Find static zlib library" OFF) | ||
option (HDF5_USE_LIBAEC_STATIC "Find static AEC library" OFF) | ||
option (ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" OFF) | ||
option (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" OFF) | ||
|
||
|
@@ -86,16 +87,29 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT) | |
set (PACKAGE_NAME ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT}) | ||
endif () | ||
set(ZLIB_FOUND FALSE) | ||
find_package (ZLIB NAMES ${PACKAGE_NAME} COMPONENTS static shared) | ||
if (HDF5_USE_ZLIB_STATIC) | ||
set(ZLIB_SEACH_TYPE static) | ||
else () | ||
set(ZLIB_SEACH_TYPE shared) | ||
endif () | ||
find_package (ZLIB NAMES ${PACKAGE_NAME} COMPONENTS ${ZLIB_SEACH_TYPE}) | ||
if (NOT ZLIB_FOUND) | ||
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") | ||
set(ZLIB_USE_STATIC_LIBS ${HDF5_USE_ZLIB_STATIC}) | ||
endif() | ||
find_package (ZLIB) # Legacy find | ||
endif () | ||
set(H5_ZLIB_FOUND ${ZLIB_FOUND}) | ||
if (H5_ZLIB_FOUND) | ||
set (H5_ZLIB_HEADER "zlib.h") | ||
set (H5_ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR}) | ||
set (H5_ZLIB_INCLUDE_DIRS ${H5_ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}) | ||
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) | ||
# The FindZLIB.cmake module does not set an OUTPUT_NAME | ||
# on the target. The target returned is: ZLIB::ZLIB | ||
get_filename_component (libname ${ZLIB_LIBRARIES} NAME_WLE) | ||
string (REGEX REPLACE "^lib" "" libname ${libname}) | ||
set_target_properties (ZLIB::ZLIB PROPERTIES OUTPUT_NAME zlib-static) | ||
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ZLIB::ZLIB) | ||
endif () | ||
else () | ||
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") | ||
|
@@ -131,9 +145,14 @@ option (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" ON) | |
if (HDF5_ENABLE_SZIP_SUPPORT) | ||
option (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" ON) | ||
if (NOT SZIP_USE_EXTERNAL) | ||
if (HDF5_USE_LIBAEC_STATIC) | ||
set(LIBAEC_SEACH_TYPE static) | ||
else () | ||
set(LIBAEC_SEACH_TYPE shared) | ||
endif () | ||
set(libaec_USE_STATIC_LIBS ${HDF5_USE_LIBAEC_STATIC}) | ||
set(SZIP_FOUND FALSE) | ||
find_package (SZIP NAMES ${LIBAEC_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) | ||
find_package (SZIP NAMES ${LIBAEC_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS ${LIBAEC_SEACH_TYPE}) | ||
if (NOT SZIP_FOUND) | ||
find_package (SZIP) # Legacy find | ||
endif () | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters