How to redirect the hipcc compiler to my custom GPU compute libraries?

I installed the AMD ROCm GPU compute stack on RHEL/AlmaLinux.

This stack doesn’t support my GPU architecture so I made the necessary changes to relevant packages i.e. rocPRIM and rocThrust and installed alternative versions which support my GPU architecture. Preinstalled versions can’t be removed due to dependencies…

Currently, the compiler hipcc sees only the versions located at /opt/rocm-5.4.0/include/thrust and /opt/rocm-5.4.0/include/rocprim the default installation paths of the AMD ROCm GPU compute stack versions for the Linux distribution I am using.

It’s probably down to use CMAKE_FIND_PACKAGE_REDIRECTS_DIR but I have no idea about the syntax to make use of it in a CMakeLists.txt file or whether that’s the right approach to solve the problem to be able to make use of the custom libraries.

How can I enforce that the compiler uses the alternative installations of rocPRIM and rocThrust located at: /opt/rocm-5.4.0/myspecialrocm/include/thrust and /opt/rocm-5.4.0/myspecialrocm/include/rocprim ?