Skip to content

FindHDF5 regression in CMake 3.23 or 3.24-rc2

Observed in the kealib port (in https://github.com/microsoft/vcpkg/pull/25365)

config-x64-windows-static-dbg-out.log

search for -static/lib used in the wrong context you will find:

Zeile 12103: E:/vcpkg_cache/downloads/tools/cmake-3.24.0-rc2-windows/cmake-3.24.0-rc2-windows-i386/share/cmake-3.24/Modules/FindHDF5.cmake(557):  set(HDF5_CXX_LIBRARY E:/vcpkg_folders/master/installed/x64-windows-static/lib/libhdf5_cpp.lib )
	Zeile 12104: E:/vcpkg_cache/downloads/tools/cmake-3.24.0-rc2-windows/cmake-3.24.0-rc2-windows-i386/share/cmake-3.24/Modules/FindHDF5.cmake(558):  list(APPEND HDF5_LIBRARIES E:/vcpkg_folders/master/installed/x64-windows-static/lib/libhdf5_cpp.lib )
	Zeile 12105: E:/vcpkg_cache/downloads/tools/cmake-3.24.0-rc2-windows/cmake-3.24.0-rc2-windows-i386/share/cmake-3.24/Modules/FindHDF5.cmake(559):  set(HDF5_CXX_LIBRARIES E:/vcpkg_folders/master/installed/x64-windows-static/lib/libhdf5_cpp.lib )
	Zeile 12114: E:/vcpkg_cache/downloads/tools/cmake-3.24.0-rc2-windows/cmake-3.24.0-rc2-windows-i386/share/cmake-3.24/Modules/FindHDF5.cmake(571):  set(HDF5_CXX_HL_LIBRARY E:/vcpkg_folders/master/installed/x64-windows-static/lib/libhdf5_hl_cpp.lib )
	Zeile 12115: E:/vcpkg_cache/downloads/tools/cmake-3.24.0-rc2-windows/cmake-3.24.0-rc2-windows-i386/share/cmake-3.24/Modules/FindHDF5.cmake(572):  list(APPEND HDF5_HL_LIBRARIES E:/vcpkg_folders/master/installed/x64-windows-static/lib/libhdf5_hl_cpp.lib )
	Zeile 12116: E:/vcpkg_cache/downloads/tools/cmake-3.24.0-rc2-windows/cmake-3.24.0-rc2-windows-i386/share/cmake-3.24/Modules/FindHDF5.cmake(573):  set(HDF5_CXX_HL_LIBRARIES E:/vcpkg_folders/master/installed/x64-windows-static/lib/libhdf5_hl_cpp.lib )

which are all wrong since they are missing at least debug/optimized keywords if both configuration are available.

This was probably introduced by !7105 (merged) due to switching from targets to library names which also misses transitive dependencies which is probably the reason for the shogun regression seen on linux in the above mentioned vcpkg PR

I also think that it was the wrong solution to solving !7105 (comment 1161477). NetCDF has to do the required find_dependency call and _LIBRARIES variables have no contract of being useable for pc files

cc @brad.king @MehdiChinoune

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information