File tree Expand file tree Collapse file tree 7 files changed +14
-5
lines changed
Expand file tree Collapse file tree 7 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -157,6 +157,10 @@ if(NOT DISABLE_HDF5)
157157 if (TARGET HDF5::HDF5)
158158 option (USE_HDF5_TARGET "Use HDF5::HDF5 CMake target for dependencies (recommended)" ON )
159159 mark_as_advanced (USE_HDF5_TARGET)
160+ # Depend on both HDF5::HDF5 (i.e. all libs just found), and hdf5::hdf5_cpp
161+ # (i.e. C++ libs and dependencies). Only the latter should be necessary, but
162+ # we need the former due to https://gitlab.kitware.com/cmake/cmake/-/issues/27379
163+ set (HDF5_TARGET HDF5::HDF5;hdf5::hdf5_cpp)
160164 if (HDF5_FIND_DEBUG) # debugging print (re-use name of FindHDF5 CMake variable)
161165 cmake_print_properties(
162166 TARGETS HDF5::HDF5
Original file line number Diff line number Diff line change @@ -29,6 +29,11 @@ option(BUILD_EXECUTABLES
2929option (BUILD_SHARED_LIBS
3030 "Use shared libraries" OFF )
3131
32+ if (BUILD_SHARED_LIBS )
33+ # needed explicitly for the registries
34+ set (CMAKE_POSITION_INDEPENDENT_CODE True )
35+ endif ()
36+
3237### Settings for external libraries
3338
3439if (LLN_FOUND)
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ endif()
104104
105105if (HAVE_HDF5)
106106 if (USE_HDF5_TARGET)
107- target_link_libraries (${TARGET} PUBLIC HDF5::HDF5 )
107+ target_link_libraries (${TARGET} PUBLIC ${HDF5_TARGET} )
108108 else ()
109109 target_include_directories (${TARGET} PUBLIC ${HDF5_INCLUDE_DIRS} )
110110 target_link_libraries (${TARGET} PUBLIC ${HDF5_CXX_LIBRARIES} )
Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ endif()
144144
145145if (HAVE_HDF5)
146146 if (USE_HDF5_TARGET)
147- target_link_libraries (${TARGET} PUBLIC HDF5::HDF5 )
147+ target_link_libraries (${TARGET} PUBLIC ${HDF5_TARGET} )
148148 else ()
149149 # for GEHDF5, TODO remove once IO dependency added or GEHDF5Wrapper no longer includes H5Cpp.h
150150 target_include_directories (${TARGET} PRIVATE ${HDF5_INCLUDE_DIRS} )
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ set(TARGET ${STIR_BUILDBLOCK_LIB})
3939
4040if (HAVE_HDF5)
4141 if (USE_HDF5_TARGET)
42- target_link_libraries (${TARGET} PUBLIC HDF5::HDF5 )
42+ target_link_libraries (${TARGET} PUBLIC ${HDF5_TARGET} )
4343 else ()
4444 # for GEHDF5, TODO remove once IO dependency added or GEHDF5Wrapper no longer includes H5Cpp.h
4545 target_include_directories (${TARGET} PRIVATE ${HDF5_INCLUDE_DIRS} )
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ set(TARGET ${STIR_BUILDBLOCK_LIB})
6161
6262if (HAVE_HDF5)
6363 if (USE_HDF5_TARGET)
64- target_link_libraries (${TARGET} PUBLIC HDF5::HDF5 )
64+ target_link_libraries (${TARGET} PUBLIC ${HDF5_TARGET} )
6565 else ()
6666 # for GEHDF5, TODO remove once IO dependency added or GEHDF5Wrapper no longer includes H5Cpp.h
6767 target_include_directories (${TARGET} PRIVATE ${HDF5_INCLUDE_DIRS} )
Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ endif()
175175
176176if (HAVE_HDF5)
177177 if (USE_HDF5_TARGET)
178- target_link_libraries (${TARGET} PUBLIC HDF5::HDF5 )
178+ target_link_libraries (${TARGET} PUBLIC ${HDF5_TARGET} )
179179 else ()
180180 # for GEHDF5, TODO remove once IO dependency added or GEHDF5Wrapper no longer includes H5Cpp.h
181181 target_include_directories (${TARGET} PRIVATE ${HDF5_INCLUDE_DIRS} )
You can’t perform that action at this time.
0 commit comments