CUDAToolkit_INCLUDE_DIR and CUDAToolkit_ROOT have no effect.

CMakeLists.txt MWE:

cmake_minimum_required(VERSION 3.17)
project(ProjectName)
find_package(CUDAToolkit)
$ cmake .. 
-- Unable to find cuda_runtime.h in "/usr/share/cuda/include" for CUDAToolkit_INCLUDE_DIR.
-- Unable to find cudart library.
-- Could NOT find CUDAToolkit (missing: CUDA_CUDART) (found version "12.2.91")
-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /home/Geremia/Downloads

When I specify the include directory containing cuda_runtime.h on my build of CUDA, it doesn’t search that directory:

$ cmake .. -DCUDAToolkit_INCLUDE_DIR=/usr/share/cuda/targets/x86_64-linux/include
-- Unable to find cuda_runtime.h in "/usr/share/cuda/include" for CUDAToolkit_INCLUDE_DIR.
-- Unable to find cudart library.
-- Could NOT find CUDAToolkit (missing: CUDA_CUDART) (found version "12.2.91")
-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /home/Geremia/Downloads

The same holds for CUDAToolkit_ROOT, too; it has no effect.

cmake version 3.27.1

@robert.maynard

https://gitlab.kitware.com/cmake/cmake/-/issues/25139