Find package finds correcly CUDAToolkit but the path is not added

Hi all,
I want to make sure that on the target system CUDAToolkit is installed. So I am using:

find_package(CUDAToolkit REQUIRED)

This finds correctly CUDAToolkit and returns the include path of the library. Now I need to use this path and include in my project, otherwise CUDA header files are not found. Apparently, CUDA uses another directory to store header files and not usr/include or so. Is there any way to ask CMAKE to add the returned path to the include directories of the project so the header files will be found during building?



You can use target_include_directories(cuda-using-target-name PRIVATE ${CUDAToolkit_INCLUDE_DIRS}) (possibly with a different visibility depending on where the headers are used).