Steps to reproduce
There needs to be a way to add extra cmake prefixes to certain proprietary packages where the odds of getting it fixed upstream is unlikely.
Create a package (foo) with the following
def setup_dependent_build_environment(self, env, dependent_spec):
if self.spec.satisfies("target=x86_64:"):
env.append_path("CMAKE_PREFIX_PATH", self.prefix.targets + "x86_64-linux/lib/cmake")
Then create a package (bar) that depends on that package (foo), and attempt to install that package (bar).
bar will not have the prefix path $foo_prefix/targets/x86_64-linux/lib/cmake provided which causes it to fail. Providing this as an environment variable doesn't work because spack passes this flag as a command line flag which has higher precedence.
I think the fix is to check this environmental variable in get_cmake_prefix_path(pkg) in build_environment.py or in build_systems/cmake.py, but I wasn't sure how to do that.
Error message
Example for a modified cuda package and a package that depends on CUB (a part of CUDA) cusz

Information on your system
- Spack: 0.18.0.dev0 (a9a08cb)
- Python: 3.10.5
- Platform: linux-fedora36-icelake
- Concretizer: clingo
General information
Steps to reproduce
There needs to be a way to add extra cmake prefixes to certain proprietary packages where the odds of getting it fixed upstream is unlikely.
Create a package (foo) with the following
Then create a package (bar) that depends on that package (foo), and attempt to install that package (bar).
bar will not have the prefix path $foo_prefix/targets/x86_64-linux/lib/cmake provided which causes it to fail. Providing this as an environment variable doesn't work because spack passes this flag as a command line flag which has higher precedence.
I think the fix is to check this environmental variable in
get_cmake_prefix_path(pkg)inbuild_environment.pyor inbuild_systems/cmake.py, but I wasn't sure how to do that.Error message
Example for a modified cuda package and a package that depends on CUB (a part of CUDA) cusz
Information on your system
General information
spack debug reportand reported the version of Spack/Python/Platform