1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-15 12:16:40 +08:00

FindHDF5: Fix finding both debug and release libs

Use `target_link_libraries` to set `INTERFACE_LINK_LIBRARIES` so that
the `debug` and `optimized` keywords work.

In commit a8e0a6b3e4 (FindHDF5: Port changes from VTK, 2020-06-10,
v3.19.0-rc1~312^2~1) we added use of `HDF5_LIBRARIES`, but the value may
contain `debug` and `optimized` keywords.

Fixes: #21637
This commit is contained in:
Kris Thielemans
2020-12-26 20:24:55 +00:00
committed by Brad King
parent 511158a03b
commit 5267ba9d63

View File

@@ -991,10 +991,10 @@ if (HDF5_FOUND)
add_library(HDF5::HDF5 INTERFACE IMPORTED)
string(REPLACE "-D" "" _hdf5_definitions "${HDF5_DEFINITIONS}")
set_target_properties(HDF5::HDF5 PROPERTIES
INTERFACE_LINK_LIBRARIES "${HDF5_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${HDF5_INCLUDE_DIRS}"
INTERFACE_COMPILE_DEFINITIONS "${_hdf5_definitions}")
unset(_hdf5_definitions)
target_link_libraries(HDF5::HDF5 INTERFACE ${HDF5_LIBRARIES})
endif ()
foreach (hdf5_lang IN LISTS HDF5_LANGUAGE_BINDINGS)