Say I have multiple versions of CUDA installed at e.g.
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.9
and both versions are on the PATH
. Can I somehow influence the version that is picked during a project(… LANGUAGES CUDA)
call or an enable_langage(CUDA)
call without changing the PATH
environment variable? By default, always the first version on the path is picked.
As far as I understand variables like CUDAToolkit_ROOT
and CMAKE_CUDA_COMPILER
only have an effect if the PATH
does not contain any CudaToolkit
entry. Is this correct? Is there a variable I am missing?
What would be the best practice to compile different CUDA programs with different toolkit version?