Tried to set CUDACXX/CUDA_PATH etc., but failed to find nvcc

I can’t seem to install tensorrt on Manjaro, and it seems to come down to a CMake issue.

I have nvcc installed at /opt/cuda/bin/nvcc and during tensorrt’s build, I get:

CMake Error at /usr/share/cmake/Modules/Internal/CMakeCUDAFindToolkit.cmake:104 (message):
  Failed to find nvcc.

  Compiler requires the CUDA toolkit.  Please set the CUDAToolkit_ROOT
  variable.
Call Stack (most recent call first):
  /usr/share/cmake/Modules/CMakeDetermineCUDACompiler.cmake:85 (cmake_cuda_find_toolkit)
  CMakeLists.txt:68 (project)

I tried setting CUDACXX, CUDA_PATH etc. according to the instructions in https://cmake.org/cmake/help/latest/module/FindCUDAToolkit.html

I tried hacking CMakeCUDAFindToolkit.cmake to force it to use /opt/cuda/ in place of /usr/local/cuda and that results in the error “Failed to detect a default CUDA architecture”.

Is this a CMake usage issue, a bug in tensorrt, or what?