py-pybind11: set correct prefix in pc files (#46298)

The detection logic for the prefix used in py-bind11 if broken for spack
resulting in an empty prefix.  However, the package provides an escape
hatch in the form of `prefix_for_pc_file`. Use this escape hatch to
provide the correct path; spack will always know better than pybind11's
CMake.

Co-authored-by: Robert Underwood <runderwood@anl.gov>
This commit is contained in:
Robert Underwood 2024-09-24 10:47:01 -04:00 committed by GitHub
parent f0e51a35c7
commit befbbec2b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -100,7 +100,10 @@ def patch(self):
class CMakeBuilder(spack.build_systems.cmake.CMakeBuilder):
def cmake_args(self):
return [self.define("PYBIND11_TEST", self.pkg.run_tests)]
return [
self.define("PYBIND11_TEST", self.pkg.run_tests),
self.define("prefix_for_pc_file", self.prefix),
]
def install(self, pkg, spec, prefix):
super().install(pkg, spec, prefix)