Skip to content

Commit 5b3b5b0

Browse files
committed
link szip if statically linked, even though we don't use szip
This is because if system libhdf5 linked szip, our builds will fail with missing szip symbols unless we also link szip. This is despite h5fortran not using szip.
1 parent 91cdfdf commit 5b3b5b0

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ if(NOT CMAKE_BUILD_TYPE)
44
endif()
55
project(h5fortran
66
LANGUAGES C Fortran
7-
VERSION 3.0.2
7+
VERSION 3.0.3
88
DESCRIPTION "thin, light object-oriented HDF5 Fortran interface"
99
HOMEPAGE_URL https://github.com/geospace-code/h5fortran)
1010
enable_testing()

cmake/hdf5.cmake

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,20 @@ endif()
2424
find_path(HDF5_MODULE_DIR NAMES hdf5.mod HINTS ${HDF5_INCLUDE_DIRS} PATH_SUFFIXES static)
2525
if(HDF5_MODULE_DIR)
2626
list(APPEND HDF5_INCLUDE_DIRS ${HDF5_MODULE_DIR})
27-
# set(SZIP_ROOT "${HDF5_MODULE_DIR}/..;${HDF5_MODULE_DIR}/../..")
27+
set(SZIP_ROOT "${HDF5_MODULE_DIR}/..;${HDF5_MODULE_DIR}/../..")
2828
set(ZLIB_ROOT "${HDF5_MODULE_DIR}/..;${HDF5_MODULE_DIR}/../..")
2929
endif()
3030
list(REMOVE_DUPLICATES HDF5_INCLUDE_DIRS)
3131

3232
# in case the compiler wrapper didn't work
3333
set(HDF5_LIBRARIES ${HDF5_Fortran_HL_LIBRARIES} ${HDF5_Fortran_LIBRARIES} ${HDF5_LIBRARIES})
3434

35-
# find_package(SZIP)
36-
# if(SZIP_FOUND)
37-
# list(APPEND HDF5_LIBRARIES SZIP::SZIP)
38-
# endif()
35+
# Szip even though not directly used because if system static links libhdf5 with szip,
36+
# our builds will fail if we don't also link szip.
37+
find_package(SZIP)
38+
if(SZIP_FOUND)
39+
list(APPEND HDF5_LIBRARIES SZIP::SZIP)
40+
endif()
3941

4042
find_package(ZLIB)
4143
if(ZLIB_FOUND)
@@ -54,8 +56,9 @@ if(UNIX)
5456
list(APPEND HDF5_LIBRARIES m)
5557
endif()
5658

57-
if(WIN32 AND MSVC)
59+
if(MSVC)
5860
# this stanza must be BEFORE if(DEFINED HDF5OK)
61+
# this is specifically for Intel compiler with HDF5 1.10 or 1.12 binary install.
5962
if(NOT DEFINED HDF5_ROOT AND DEFINED ENV{HDF5_ROOT})
6063
file(TO_CMAKE_PATH "$ENV{HDF5_ROOT}" HDF5_ROOT)
6164
endif()

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
project('h5fortran', 'fortran',
22
meson_version : '>=0.52.0',
3-
version : '3.0.2',
3+
version : '3.0.3',
44
default_options : ['default_library=static', 'buildtype=release', 'warning_level=3'])
55

66
subdir('meson')

0 commit comments

Comments
 (0)