File tree 1 file changed +20
-7
lines changed 1 file changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -191,7 +191,8 @@ if(hdf5_have_zlib)
191
191
DOC "SZIP header"
192
192
)
193
193
194
- if (NOT SZIP_LIBRARY AND SZIP_INCLUDE_DIR)
194
+ if (NOT (SZIP_LIBRARY AND SZIP_INCLUDE_DIR))
195
+ message (VERBOSE "FindHDF5: SZIP not found, but HDF5 indicates it was built with SZIP. This may cause build errors." )
195
196
return ()
196
197
endif ()
197
198
@@ -909,17 +910,29 @@ if(HDF5_FOUND)
909
910
set_property (TARGET HDF5::HDF5 PROPERTY INTERFACE_LINK_LIBRARIES "${HDF5_LIBRARIES} " )
910
911
set_property (TARGET HDF5::HDF5 PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${HDF5_INCLUDE_DIRS} " )
911
912
912
- target_include_directories (HDF5::HDF5 INTERFACE
913
- $<$<BOOL :${hdf5_have_szip} >:${SZIP_INCLUDE_DIR} >
914
- )
913
+ if (hdf5_have_szip)
914
+ if (IS_DIRECTORY "${SZIP_INCLUDE_DIR} " )
915
+ target_include_directories (HDF5::HDF5 INTERFACE ${SZIP_INCLUDE_DIR} )
916
+ else ()
917
+ message (STATUS "FindHDF5: SZIP_INCLUDE_DIR ${SZIP_INCLUDE_DIR} is not a directory." )
918
+ endif ()
919
+ endif ()
920
+
921
+ target_link_libraries (HDF5::HDF5 INTERFACE $<$<BOOL :${hdf5_have_zlib} >:ZLIB::ZLIB>)
922
+
923
+ if (hdf5_have_szip)
924
+ if (EXISTS "${SZIP_LIBRARY} " )
925
+ target_link_libraries (HDF5::HDF5 INTERFACE ${SZIP_LIBRARY} )
926
+ else ()
927
+ message (STATUS "FindHDF5: SZIP_LIBRARY ${SZIP_LIBRARY} is not a file." )
928
+ endif ()
929
+ endif ()
930
+
915
931
target_link_libraries (HDF5::HDF5 INTERFACE
916
- $<$<BOOL :${hdf5_have_zlib} >:ZLIB::ZLIB>
917
- $<$<BOOL :${hdf5_have_szip} >:${SZIP_LIBRARY} >
918
932
${CMAKE_THREAD_LIBS_INIT}
919
933
${CMAKE_DL_LIBS}
920
934
$<$<BOOL :${UNIX} >:m>
921
935
)
922
-
923
936
endif ()
924
937
endif (HDF5_FOUND)
925
938
You can’t perform that action at this time.
0 commit comments