mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +00:00
Fix HDF5 config-mode detection to use shared library when static is absent
When HDF5 is found via its CMake config file, the code previously hardcoded the hdf5_cpp-static target. On distributions that ship only shared HDF5 (e.g. Fedora rawhide where the config file was added in a newer package), this caused a link failure. Now checks for hdf5_cpp-static, hdf5_cpp-shared, and hdf5::hdf5_cpp-shared in order, falling back to module-mode discovery.
This commit is contained in:
@@ -88,7 +88,15 @@ if(NOT HDF5_INCLUDE_DIR OR NOT HDF5_LIBRARY_DIR)
|
|||||||
mark_as_advanced(HDF5_DIR)
|
mark_as_advanced(HDF5_DIR)
|
||||||
if(HDF5_DIR)
|
if(HDF5_DIR)
|
||||||
message(STATUS "HDF5: found config at '${HDF5_DIR}'.")
|
message(STATUS "HDF5: found config at '${HDF5_DIR}'.")
|
||||||
set(HDF5_LIBRARIES hdf5_cpp-static)
|
if(TARGET hdf5_cpp-static)
|
||||||
|
set(HDF5_LIBRARIES hdf5_cpp-static)
|
||||||
|
elseif(TARGET hdf5_cpp-shared)
|
||||||
|
set(HDF5_LIBRARIES hdf5_cpp-shared)
|
||||||
|
elseif(TARGET hdf5::hdf5_cpp-shared)
|
||||||
|
set(HDF5_LIBRARIES hdf5::hdf5_cpp-shared)
|
||||||
|
else()
|
||||||
|
find_package(HDF5 REQUIRED COMPONENTS CXX)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
# If it failed, still try to find as a module.
|
# If it failed, still try to find as a module.
|
||||||
# E.g. on Ubuntu `libhdf5-dev` doesn't provie hdf5-config.cmake.
|
# E.g. on Ubuntu `libhdf5-dev` doesn't provie hdf5-config.cmake.
|
||||||
|
|||||||
Reference in New Issue
Block a user