Skip to content

cmake build system needs a way to add additional CMAKE_PREFIX_PATH entries for things like CUDA #31568

@robertu94

Description

@robertu94

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

image

Information on your system

  • Spack: 0.18.0.dev0 (a9a08cb)
  • Python: 3.10.5
  • Platform: linux-fedora36-icelake
  • Concretizer: clingo

General information

  • I have run spack debug report and reported the version of Spack/Python/Platform
  • I have searched the issues of this repo and believe this is not a duplicate
  • I have run the failing commands in debug mode and reported the output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageThe issue needs to be prioritized

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions