netcdf-c package: correct library names (#42878)

An incorrect hdf5 library name is added to pkconfig and CMake config
files when netcdf-c is built with CMake.
This commit is contained in:
Chris Marsh 2024-03-02 13:05:59 -06:00 committed by GitHub
parent 8dcf860888
commit eb36bb2a8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -351,6 +351,24 @@ def cmake_args(self):
base_cmake_args.append(self.define("NC_FIND_SHARED_LIBS", False))
return base_cmake_args
@run_after("install")
def patch_hdf5_pkgconfigcmake(self):
"""
Incorrect hdf5 library names are put in the package config and config.cmake files
due to incorrectly using hdf5 target names
https://github.com/spack/spack/pull/42878
"""
pkgconfig_file = find(self.prefix, "netcdf.pc", recursive=True)
cmakeconfig_file = find(self.prefix, "netCDFTargets.cmake", recursive=True)
ncconfig_file = find(self.prefix, "nc-config", recursive=True)
settingsconfig_file = find(self.prefix, "libnetcdf.settings", recursive=True)
files = pkgconfig_file + cmakeconfig_file + ncconfig_file + settingsconfig_file
filter_file("hdf5-shared", "hdf5", *files, ignore_absent=True)
filter_file("hdf5_hl-shared", "hdf5_hl", *files, ignore_absent=True)
class AutotoolsBuilder(BaseBuilder, autotools.AutotoolsBuilder):
@property