FindCUDAToolkit CUDA::cupti fails since 3.24.1

Hi,
Since possibly a recent change, FindCUDAToolkit fails to find the libcupti since it is not looking to /usr/loca/cuda/include path anymore. Nvidia cuda packages install headers together with the other headers instead of /usr/local/cuda/extras/CUPTI/ as searched by the package.

$ dpkg -L cuda-cupti-dev-11-4 |grep cupti.h
/usr/local/cuda-11.4/targets/x86_64-linux/include/cupti.h
$ cmake --version
make version 3.24.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

$ CUDAToolkit_ROOT_DIR=/usr/local/cuda cmake --debug-find-pkg=CUDAToolkit ../ -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_VERBOSE_MAKEFILE=ON -DCUDAToolkit_ROOT_DIR=/usr/local/cuda 

<...truncated for brevity ...>

Call Stack (most recent call first):
  /usr/share/cmake-3.24/Modules/FindCUDAToolkit.cmake:977 (_CUDAToolkit_find_and_add_import_lib)
  CMakeLists.txt:20 (find_package)


CMake Debug Log at /usr/share/cmake-3.24/Modules/FindCUDAToolkit.cmake:980 (find_path):
  find_path called with the following settings:

    VAR: CUDAToolkit_CUPTI_INCLUDE_DIR
    NAMES: "cupti.h"
    Documentation: Path to a file.
    Framework
      Only Search Frameworks: 0
      Search Frameworks Last: 0
      Search Frameworks First: 0
    AppBundle
      Only Search AppBundle: 0
      Search AppBundle Last: 0
      Search AppBundle First: 0
    NO_DEFAULT_PATH Enabled

  find_path considered the following locations:

    /usr/local/cuda/extras/CUPTI/include/cupti.h
    <PROJECT_ROOT_REDACTED>/cupti.h

  The item was not found.

 <.. truncated for brevity ...>

Call Stack (most recent call first):
  CMakeLists.txt:20 (find_package)


CMake Debug Log at CMakeLists.txt:20 (find_package):
  find_package considered the following paths for FindCUDAToolkit.cmake:

    <PROJECT_ROOT_REDACTED>/cmake/FindCUDAToolkit.cmake

  The file was found at

    /usr/share/cmake-3.24/Modules/FindCUDAToolkit.cmake

Is it possible to add CUDAToolkit_INCLUDE_DIR to search paths? What is the suggested solution here other than setting the CUDAToolkit_CUPTI_INCLUDE_DIR manually?

Thanks,
Sami

@robert.maynard

https://gitlab.kitware.com/cmake/cmake/-/merge_requests/7608

Thank you very much!