Do I still need FindCUDA ?

Michaël SCHERER
Fri, 14 Aug 2020 06:35:57 +0000
Code

Hello CMake Community !

I just had the opportunity to update one of our Ubuntu 20.04 host at work with the last stable CMake snap (actually version 3.18.1) and have been surprised with an error during the build of our project, using Nvidia CUDA, saying that the property CUDA_ARCHITECTURES was not properly set.
Okay , than I looked in the documentation and saw that a new FindCUDAToolkit exists and decided to use it.
Except that CMake 3.18.1 doesn’t agree with me and gives me the following error :

By not providing "FindFindCUDAToolkit.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"FindCUDAToolkit", but CMake did not find one.

Could not find a package configuration file provided by "FindCUDAToolkit"
with any of the following names:

  FindCUDAToolkitConfig.cmake
  findcudatoolkit-config.cmake

Finding this unbelievable, I searched for this .cmake file on the host and found it there :
/snap/cmake/513/share/cmake-3.18/Modules/FindCUDAToolkit.cmake

So, the file exists, but I don’t understand why CMake doesn’t find it.
Does it only search for CMake Modules in the project’s root folder and /usr/lib/x86_64-linux-gnu/cmake/?
Do I really need to add the path manually to CMAKE_MODULE_PATH or is there a better/proper way to deal with this issue ?

Thanks in advance for your information !
Best Regards !

6 posts - 4 participants